Metadata

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

Solutions

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

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

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

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

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

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

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

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

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

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

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup = ""
    var depth = 0

    for char in parenString.trimmingCharacters(in: .whitespaces) {
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString.trimmingCharacters(in: .whitespaces) {
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}

// Test cases to verify the correctness of the function
print(separateParenGroups(parenString: "( ) (( )) (( )( ))")) // ["()", "(())", "(()())"]
print(separateParenGroups(parenString: "((()))(())()")) // ["((()))", "(())", "()"]
print(separateParenGroups(parenString: "()()()")) // ["()", "()", "()"]
print(separateParenGroups(parenString: "(()(())))")) // ["(()(()))", "()"]
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}

// Test cases
print(separateParenGroups(parenString: "( ) (( )) (( )( ))")) // ["()", "(())", "(()())"]
print(separateParenGroups(parenString: "(()()) ((()())())")) // ["(()())", "((()())())"]
print(separateParenGroups(parenString: "((()()())())")) // ["((()()())())"]
print(separateParenGroups(parenString: "(()(())) (())")) // ["(()(()))", "(())"]
```
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        } else if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}

// Test cases
print(separateParenGroups(parenString: "( ) (( )) (( )( ))")) // ["()", "(())", "(()())"]
print(separateParenGroups(parenString: "(()())(())")) // ["(()())", "(())"]
print(separateParenGroups(parenString: "((()())())")) // ["((()())())"]
```
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString.trimmingCharacters(in: .whitespaces) {
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString.trimmingCharacters(in: .whitespaces) {
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var depth = 0

    for char in parenString {
        if char == " " {
            continue
        }
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

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

    for char in parenString {
        if char == " " {
            continue
        }
        if char == "(" {
            depth += 1
            currentGroup += char
        } else if char == ")" {
            depth -= 1
            currentGroup += char
            if depth == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        }
    }

    return result
}
```

currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += char // cannot convert value of type 'Character' to expected argument type 'String'

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

return number - Int(number) // cannot convert value of type 'Int' to expected argument type 'Double'

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

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

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

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

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

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

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

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

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

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 op in operations {
        balance += op
        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 op in operations {
        balance += op
        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 = 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.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.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.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.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)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.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)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.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)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0, +) / 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.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.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 intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

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

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

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

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

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

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

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

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

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

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    return result
}

// Test the function with the provided example
let testString = "(()()) ((())) () ((())()())"
let result = parseNestedParens(parenString: testString)
print(result) // Output: [2, 3, 1, 3]
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    return result
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result: [Int] = []
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        
        if let lastElement = result.last {
            if lastElement != maxNestingLevel {
                result.append(maxNestingLevel)
            }
        } else {
            result.append(maxNestingLevel)
        }
    }
    
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result: [Int] = []
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        
        if let lastElement = result.last {
            if lastElement != maxNestingLevel {
                result.append(maxNestingLevel)
            }
        } else {
            result.append(maxNestingLevel)
        }
    }
    
    return result
}

// Test cases
let testCases = [
    "(()()) ((())) () ((())()())",
    "(((())))",
    "()",
    "((()))",
    "(()(()))"
]

for testCase in testCases {
    print(parseNestedParens(parenString: testCase))
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var currentLevel = 0
    var maxLevel = 0
    for char in parenString {
        if char == "(" {
            currentLevel += 1
            maxLevel = max(maxLevel, currentLevel)
        } else if char == ")" {
            currentLevel -= 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 currentLevel = 0
    var maxLevel = 0
    for char in parenString {
        if char == "(" {
            currentLevel += 1
            maxLevel = max(maxLevel, currentLevel)
        } else if char == ")" {
            currentLevel -= 1
        }
        result.append(maxLevel)
    }
    return result
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        result.append(maxNestingLevel)
    }
    
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        result.append(maxNestingLevel)
    }
    
    return result
}

// Test cases
print(parseNestedParens(parenString: "(()()) ((())) () ((())()())")) // Output: [2, 3, 1, 3]
print(parseNestedParens(parenString: "()()")) // Output: [1, 1]
print(parseNestedParens(parenString: "()")) // Output: [1]
print(parseNestedParens(parenString: "((()))")) // Output: [3]
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    return result
}

// Test cases
print(parseNestedParens(parenString: "(()()) ((())) () ((())()())")) // [2, 3, 1, 3]
print(parseNestedParens(parenString: "(((())))")) // [4]
print(parseNestedParens(parenString: "()()")) // [1, 1]
print(parseNestedParens(parenString: "()")) // [1]
print(parseNestedParens(parenString: "(()")) // [2]
print(parseNestedParens(parenString: "())")) // [1]
print(parseNestedParens(parenString: "(()()) ((())) () ((())()())")) // [2, 3, 1, 3]
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            if currentNestingLevel > maxNestingLevel {
                maxNestingLevel = currentNestingLevel
            }
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    return result
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result: [Int] = []
    var currentLevel = 0
    var maxLevel = 0
    for char in parenString {
        if char == "(" {
            currentLevel += 1
            maxLevel = max(maxLevel, currentLevel)
        } else if char == ")" {
            currentLevel -= 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 currentLevel = 0
    var maxLevel = 0
    for char in parenString {
        if char == "(" {
            currentLevel += 1
            maxLevel = max(maxLevel, currentLevel)
        } else if char == ")" {
            currentLevel -= 1
        }
        result.append(maxLevel)
    }
    return result
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        result.append(maxNestingLevel)
    }
    
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
        result.append(maxNestingLevel)
    }
    
    return result
}
```

 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    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 maxNestingLevel = 0
    var currentNestingLevel = 0
    var result = [Int]()
    
    for char in parenString {
        if char == "(" {
            currentNestingLevel += 1
            maxNestingLevel = max(maxNestingLevel, currentNestingLevel)
        } else if char == ")" {
            currentNestingLevel -= 1
        }
    }
    
    result.append(maxNestingLevel)
    return result
}

// Test cases
print(parseNestedParens(parenString: "(()()) ((())) () ((())()())")) // [2, 3, 1, 3]
print(parseNestedParens(parenString: "((())) (()) ()")) // [3, 2, 1]
print(parseNestedParens(parenString: "() () ()")) // [1, 1, 1]
print(parseNestedParens(parenString: "()")) // [1]
print(parseNestedParens(parenString: "")) // []
```

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

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

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

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

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

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

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

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

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

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

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

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

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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 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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(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)
}
```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)
}

// Test cases
print(sumProduct(numbers: [] as [Int])) // (0, 1)
print(sumProduct(numbers: [1, 2, 3, 4])) // (10, 24)
```

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

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

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

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

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

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

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

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

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

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

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

longestPalindrome = substring // cannot assign value of type 'Substring' to type 'String'

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

func makePalindrome(string: String) -> String {
    guard string.count > 1 else { return string }
    var longestPalindrome = ""
    for i in 0..<string.count {
        let prefix = string.prefix(i + 1)
        let suffix = string.suffix(string.count - i)
        if prefix == String(prefix.reversed()) && prefix.count > longestPalindrome.count {
            longestPalindrome = prefix
        }
    }
    return string + String(longestPalindrome.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 }
    var longestPalindrome = ""
    for i in 0..<string.count {
        let prefix = string.prefix(i + 1)
        let suffix = string.suffix(string.count - i)
        if prefix == String(prefix.reversed()) && prefix.count > longestPalindrome.count {
            longestPalindrome = prefix
        }
    }
    return string + String(longestPalindrome.reversed())
}
```

longestPalindrome = prefix // cannot assign value of type 'String.SubSequence' (aka 'Substring') to type 'String'

func makePalindrome(string: String) -> String {
    let string = string.lowercased()
    let reversedString = string.reversed()
    for i in 0..<string.count {
        if string.hasSuffix(reversedString.prefix(string.count - i)) {
            return string + reversedString.suffix(string.count - i)
        }
    }
    return 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 {
    let string = string.lowercased()
    let reversedString = string.reversed()
    for i in 0..<string.count {
        if string.hasSuffix(reversedString.prefix(string.count - i)) {
            return string + reversedString.suffix(string.count - i)
        }
    }
    return string
}
```

if string.hasSuffix(reversedString.prefix(string.count - i)) { // cannot convert value of type 'ReversedCollection<String>.SubSequence' (aka 'Slice<ReversedCollection<String>>') to expected argument type 'String'

func makePalindrome(string: String) -> String {
    let reversedString = String(string.reversed())
    for i in 0..<string.count {
        if string.hasPrefix(reversedString.substring(from: i)) {
            return string + reversedString.substring(from: i)
        }
    }
    return 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 {
    let reversedString = String(string.reversed())
    for i in 0..<string.count {
        if string.hasPrefix(reversedString.substring(from: i)) {
            return string + reversedString.substring(from: i)
        }
    }
    return string
}
```

if string.hasPrefix(reversedString.substring(from: i)) { // cannot convert value of type 'Int' to expected argument type 'String.Index'
return string + reversedString.substring(from: i) // cannot convert value of type 'Int' to expected argument type 'String.Index'

```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.hasPrefix("a") else { return string + "a" }
    guard !string.hasSuffix("a") else { return string + "a" }
    guard !string.hasPrefix("b") else { return string + "b" }
    guard !string.hasSuffix("b") else { return string + "b" }
    guard !string.hasPrefix("c") else { return string + "c" }
    guard !string.hasSuffix("c") else { return string + "c" }
    guard !string.hasPrefix("d") else { return string + "d" }
    guard !string.hasSuffix("d") else { return string + "d" }
    guard !string.hasPrefix("e") else { return string + "e" }
    guard !string.hasSuffix("e") else { return string + "e" }
    guard !string.hasPrefix("f") else { return string + "f" }
    guard !string.hasSuffix("f") else { return string + "f" }
    guard !string.hasPrefix("g") else { return string + "g" }
    guard !string.hasSuffix("g") else { return string + "g" }
    guard !string.hasPrefix("h") else { return string + "h" }
    guard !string.hasSuffix("h") else { return string + "h" }
    guard !string.hasPrefix("i") else { return string + "i" }
    guard !string.hasSuffix("i") else { return string + "i" }
    guard !string.hasPrefix("j") else { return string + "j" }
    guard !string.hasSuffix("j") else { return string + "j" }
    guard !string.hasPrefix("k") else { return string + "k" }
    guard !string.hasSuffix("k") else { return string + "k" }
    guard !string.hasPrefix("l") else { return string + "l" }
    guard !string.hasSuffix("l") else { return string + "l" }
    guard !string.hasPrefix("m") else { return string + "m" }
    guard !string.hasSuffix("m") else { return string + "m" }
    guard !string.hasPrefix("n") else { return string + "n" }
    guard !string.hasSuffix("n") else { return string + "n" }
    guard !string.hasPrefix("o") else { return string + "o" }
    guard !string.hasSuffix("o") else { return string + "o" }
    guard !string.hasPrefix("p") else { return string + "p" }
    guard !string.hasSuffix("p") else { return string + "p" }
    guard !string.hasPrefix("q") else { return string + "q" }
    guard !string.hasSuffix("q") else { return string + "q" }
    guard !string.hasPrefix("r") else { return string + "r" }
    guard !string.hasSuffix("r") else { return string + "r" }
    guard !string.hasPrefix("s") else { return string + "s" }
    guard !string.hasSuffix("s") else { return string + "s" }
    guard !string.hasPrefix("t") else { return string + "t" }
    guard !string.hasSuffix("t") else { return string + "t" }
    guard !string.hasPrefix("u") else { return string + "u" }
    guard !string.hasSuffix("u") else { return string + "u" }
    guard !string.hasPrefix("v") else { return string + "v" }
    guard !string.hasSuffix("v") else { return string + "v" }
    guard !string.hasPrefix("w") else { return string + "w" }
    guard !string.hasSuffix("w") else { return string + "w" }
    guard !string.hasPrefix("x") else { return string + "x" }
    guard !string.hasSuffix("x") else { return string + "x" }
    guard !string.hasPrefix("y") else { return string + "y" }
    guard !string.hasSuffix("y") else { return string + "y" }
    guard !string.hasPrefix("z") else { return string + "z" }
    guard !string.hasSuffix("z") else { return string + "z" }
    guard !string.hasPrefix("aa") else { return string + "aa" }
    guard !string.hasSuffix("aa") else { return string + "aa" }
    guard !string.hasPrefix("ab") else { return string + "ab" }
    guard !string.hasSuffix("ab") else { return string + "ab" }
    guard !string.has
XCTAssertTrue(makePalindrome(string: "") == "") // cannot find 'makePalindrome' in scope
XCTAssertTrue(makePalindrome(string: "x") == "x") // cannot find 'makePalindrome' in scope
XCTAssertTrue(makePalindrome(string: "xyz") == "xyzyx") // cannot find 'makePalindrome' in scope
XCTAssertTrue(makePalindrome(string: "xyx") == "xyx") // cannot find 'makePalindrome' in scope
XCTAssertTrue(makePalindrome(string: "jerry") == "jerryrrej") // cannot find 'makePalindrome' in scope

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = String(string.reversed())
    let reversedPrefix = reversedString.prefix(string.count)
    let reversedSuffix = reversedString.suffix(string.count)
    if reversedPrefix == reversedSuffix {
        return string + reversedSuffix
    } else {
        return makePalindrome(string: reversedSuffix) + 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 "" }
    let reversedString = String(string.reversed())
    let reversedPrefix = reversedString.prefix(string.count)
    let reversedSuffix = reversedString.suffix(string.count)
    if reversedPrefix == reversedSuffix {
        return string + reversedSuffix
    } else {
        return makePalindrome(string: reversedSuffix) + string
    }
}
```

return makePalindrome(string: reversedSuffix) + string // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func makePalindrome(string: String) -> String {
    let string = string.lowercased()
    let reversedString = string.reversed()
    for i in 0..<string.count {
        if string.hasPrefix(reversedString.prefix(string.count - i)) {
            return string + reversedString.suffix(string.count - i)
        }
    }
    return 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 {
    let string = string.lowercased()
    let reversedString = string.reversed()
    for i in 0..<string.count {
        if string.hasPrefix(reversedString.prefix(string.count - i)) {
            return string + reversedString.suffix(string.count - i)
        }
    }
    return string
}
```
if string.hasPrefix(reversedString.prefix(string.count - i)) { // cannot convert value of type 'ReversedCollection<String>.SubSequence' (aka 'Slice<ReversedCollection<String>>') to expected argument type 'String'

func makePalindrome(string: String) -> String {
    let string = string.lowercased()
    let stringLength = string.count
    var longestPalindrome = ""
    var longestPalindromeLength = 0
    var i = 0
    while i < stringLength {
        let substring = string.substring(from: string.index(string.startIndex, offsetBy: i))
        let reversedSubstring = String(substring.reversed())
        if substring == reversedSubstring {
            longestPalindrome = substring
            longestPalindromeLength = substring.count
        }
        i += 1
    }
    let prefix = string.substring(to: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength))
    let suffix = string.substring(from: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength))
    return prefix + longestPalindrome + suffix.reversed()
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let string = string.lowercased()
    let stringLength = string.count
    var longestPalindrome = ""
    var longestPalindromeLength = 0
    var i = 0
    while i < stringLength {
        let substring = string.substring(from: string.index(string.startIndex, offsetBy: i))
        let reversedSubstring = String(substring.reversed())
        if substring == reversedSubstring {
            longestPalindrome = substring
            longestPalindromeLength = substring.count
        }
        i += 1
    }
    let prefix = string.substring(to: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength))
    let suffix = string.substring(from: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength))
    return prefix + longestPalindrome + suffix.reversed()
}
```

let substring = string.substring(from: string.index(string.startIndex, offsetBy: i)) // 'substring(from:)' is deprecated: Please use String slicing subscript with a 'partial range from' operator.
let prefix = string.substring(to: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength)) // 'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator.
let suffix = string.substring(from: string.index(string.startIndex, offsetBy: stringLength - longestPalindromeLength)) // 'substring(from:)' is deprecated: Please use String slicing subscript with a 'partial range from' operator.
 // XCTAssertTrue failed

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

let suffix = string.suffix(i) // initialization of immutable value 'suffix' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let bitA = a[a.index(a.startIndex, offsetBy: i)] == "1" ? "1" : "0"
        let bitB = b[b.index(b.startIndex, offsetBy: i)] == "1" ? "1" : "0"
        let xorResult = bitA == bitB ? "0" : "1"
        result += xorResult
    }
    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 {
        let bitA = a[a.index(a.startIndex, offsetBy: i)] == "1" ? "1" : "0"
        let bitB = b[b.index(b.startIndex, offsetBy: i)] == "1" ? "1" : "0"
        let xorResult = bitA == bitB ? "0" : "1"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, charA) in a.enumerated() {
        let charB = b[i]
        let xorResult = charA == "1" ? "0" : "1"
        result += xorResult
    }
    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, charA) in a.enumerated() {
        let charB = b[i]
        let xorResult = charA == "1" ? "0" : "1"
        result += xorResult
    }
    return result
}
```
let charB = b[i] // initialization of immutable value 'charB' was never used; consider replacing with assignment to '_' or removing it
let charB = 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, charA) in a.enumerated() {
        let charB = b[i]
        let xorResult = charA == "1" ? "0" : "1"
        result += xorResult
    }
    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, charA) in a.enumerated() {
        let charB = b[i]
        let xorResult = charA == "1" ? "0" : "1"
        result += xorResult
    }
    return result
}
```

let charB = b[i] // initialization of immutable value 'charB' was never used; consider replacing with assignment to '_' or removing it
let charB = 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, charA) in a.enumerated() {
        let charB = b[a.index(a.startIndex, offsetBy: i)]
        let xorResult = charA != charB ? "1" : "0"
        result += xorResult
    }
    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, charA) in a.enumerated() {
        let charB = b[a.index(a.startIndex, offsetBy: i)]
        let xorResult = charA != charB ? "1" : "0"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA != charB ? "1" : "0"
        result += xorResult
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA != charB ? "1" : "0"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = (charA == "1" && charB == "1") ? "0" : (charA == "0" && charB == "0") ? "0" : "1"
        result += xorResult
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = (charA == "1" && charB == "1") ? "0" : (charA == "0" && charB == "0") ? "0" : "1"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" && charB == "1" ? "0" : charA == "0" && charB == "0" ? "0" : "1"
        result += xorResult
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" && charB == "1" ? "0" : charA == "0" && charB == "0" ? "0" : "1"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = (charA == "1" && charB == "1") ? "0" : (charA == "0" && charB == "0") ? "0" : "1"
        result.append(xorResult)
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = (charA == "1" && charB == "1") ? "0" : (charA == "0" && charB == "0") ? "0" : "1"
        result.append(xorResult)
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" && charB == "1" ? "0" : charA == "0" && charB == "0" ? "0" : "1"
        result += xorResult
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" && charB == "1" ? "0" : charA == "0" && charB == "0" ? "0" : "1"
        result += xorResult
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" ? (charB == "1" ? "0" : "1") : (charB == "1" ? "1" : "0")
        result += xorResult
    }
    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 {
        let charA = a[a.index(a.startIndex, offsetBy: i)]
        let charB = b[b.index(b.startIndex, offsetBy: i)]
        let xorResult = charA == "1" ? (charB == "1" ? "0" : "1") : (charB == "1" ? "1" : "0")
        result += xorResult
    }
    return result
}
```

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

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

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

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

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

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

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

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

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

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

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 {
    var a = a
    var b = b
    while b != 0 {
        let t = b
        b = a % b
        a = t
    }
    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 t = b
        b = a % b
        a = t
    }
    return 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 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 {
    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
}
```

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

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

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

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

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

func allSuffixes(string: String) -> [String] {
    var suffixes = [String]()
    for i in 0..<string.count {
        suffixes.append(string.suffix(string.count - i))
    }
    return suffixes
}

func allSubstrings(string: String) -> [String] {
    var substrings = [String]()
    for i in 0..<string.count {
        for j in i..<string.count {
            substrings.append(string.suffix(j - i + 1))
        }
    }
    return substrings
}
```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
}

// Return array of all suffixes from shortest to longest of the input string
// allSuffixes(string: "abc") == ["c", "bc", "abc"]
func allSuffixes(string: String) -> [String] {
    var suffixes = [String]()
    for i in 0..<string.count {
        suffixes.append(string.suffix(string.count - i))
    }
    return suffixes
}

// Return array of all substrings from shortest to longest of the input string
// allSubstrings(string: "abc") == ["a", "ab", "abc", "b", "bc", "c"]
func allSubstrings(string: String) -> [String] {
    var substrings = [String]()
    for i in 0..<string.count {
        for j in i..<string.count {
            substrings.append(string.suffix(j - i + 1))
        }
    }
    return substrings
}
```

prefixes.append(string.prefix(i + 1)) // no exact matches in call to instance method 'append'
suffixes.append(string.suffix(string.count - i)) // no exact matches in call to instance method 'append'
substrings.append(string.suffix(j - 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 stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n {
        result += String(i) + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n {
        result += String(i) + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

// Test cases
print(stringSequence(n: 0)) // Output: "0"
print(stringSequence(n: 5)) // Output: "0 1 2 3 4 5"
```
 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    var charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.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 charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.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 charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.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 charSet = Set<Character>()
    for char in string.lowercased() {
        charSet.insert(char)
    }
    return charSet.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    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 char in string.lowercased() {
        distinctCharacters.insert(char)
    }
    return distinctCharacters.count
}
```

func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    var currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNote = ""
    var currentCount = 0
    for char in musicString {
        if char == "o" {
            if currentNote == "o" {
                currentCount += 4
            } else {
                currentNote = "o"
                currentCount = 4
            }
        } else if char == "o|" {
            if currentNote == "o" {
                currentCount += 2
            } else {
                currentNote = "o|"
                currentCount = 2
            }
        } else if char == "." {
            if currentNote == "o" {
                currentCount += 1
            } else {
                currentNote = "."
                currentCount = 1
            }
        }
        result.append(currentCount)
    }
    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 currentNote = ""
    var currentCount = 0
    for char in musicString {
        if char == "o" {
            if currentNote == "o" {
                currentCount += 4
            } else {
                currentNote = "o"
                currentCount = 4
            }
        } else if char == "o|" {
            if currentNote == "o" {
                currentCount += 2
            } else {
                currentNote = "o|"
                currentCount = 2
            }
        } else if char == "." {
            if currentNote == "o" {
                currentCount += 1
            } else {
                currentNote = "."
                currentCount = 1
            }
        }
        result.append(currentCount)
    }
    return result
}
```
} else if char == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    var currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNote = ""
    var currentLength = 0
    for char in musicString {
        if char == "o" {
            currentLength = 4
        } else if char == "o|" {
            currentLength = 2
        } else if char == "." {
            currentLength = 1
        }
        currentNote += String(char)
        if currentNote == "o" || currentNote == "o|" {
            result.append(currentLength)
            currentNote = ""
        }
    }
    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 currentNote = ""
    var currentLength = 0
    for char in musicString {
        if char == "o" {
            currentLength = 4
        } else if char == "o|" {
            currentLength = 2
        } else if char == "." {
            currentLength = 1
        }
        currentNote += String(char)
        if currentNote == "o" || currentNote == "o|" {
            result.append(currentLength)
            currentNote = ""
        }
    }
    return result
}
```

} else if char == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentNote = ""
    var currentLength = 0
    
    for char in musicString {
        if char == "o" {
            currentNote = "o"
            currentLength = 4
        } else if char == "o|" {
            currentNote = "o|"
            currentLength = 2
        } else if char == "." {
            currentNote = ".|"
            currentLength = 1
        }
        
        if currentNote != "" {
            result.append(currentLength)
            currentNote = ""
            currentLength = 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] {
    var result = [Int]()
    var currentNote = ""
    var currentLength = 0
    
    for char in musicString {
        if char == "o" {
            currentNote = "o"
            currentLength = 4
        } else if char == "o|" {
            currentNote = "o|"
            currentLength = 2
        } else if char == "." {
            currentNote = ".|"
            currentLength = 1
        }
        
        if currentNote != "" {
            result.append(currentLength)
            currentNote = ""
            currentLength = 0
        }
    }
    
    return result
}
```

} else if char == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNoteDuration = 0
    for char in musicString {
        switch char {
        case "o":
            currentNoteDuration = 4
        case "o|":
            currentNoteDuration = 2
        case ".|":
            currentNoteDuration = 1
        default:
            break
        }
        result.append(currentNoteDuration)
    }
    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 currentNote = ""
    var currentCount = 0
    
    for char in musicString {
        if char == "o" {
            currentNote = "o"
        } else if char == "o|" {
            currentNote = "o|"
        } else if char == "." {
            currentNote = ".|"
        }
        
        if currentNote == currentNote {
            currentCount += 1
        } else {
            result.append(currentCount)
            currentCount = 1
            currentNote = ""
        }
    }
    
    result.append(currentCount)
    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 currentNote = ""
    var currentCount = 0
    
    for char in musicString {
        if char == "o" {
            currentNote = "o"
        } else if char == "o|" {
            currentNote = "o|"
        } else if char == "." {
            currentNote = ".|"
        }
        
        if currentNote == currentNote {
            currentCount += 1
        } else {
            result.append(currentCount)
            currentCount = 1
            currentNote = ""
        }
    }
    
    result.append(currentCount)
    return result
}
```

} else if char == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    for note in musicString.components(separatedBy: " ") {
        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] {
    var result: [Int] = []
    for note in musicString.components(separatedBy: " ") {
        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]()
    for note in musicString.components(separatedBy: " ") {
        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] {
    var result = [Int]()
    for note in musicString.components(separatedBy: " ") {
        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 currentNote = ""
    var currentCount = 0
    
    for char in musicString {
        if char == "o" {
            currentCount = 4
        } else if char == "o|" {
            currentCount = 2
        } else if char == "." {
            currentCount = 1
        }
        
        if currentCount > 0 {
            result.append(currentCount)
            currentCount = 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] {
    var result = [Int]()
    var currentNote = ""
    var currentCount = 0
    
    for char in musicString {
        if char == "o" {
            currentCount = 4
        } else if char == "o|" {
            currentCount = 2
        } else if char == "." {
            currentCount = 1
        }
        
        if currentCount > 0 {
            result.append(currentCount)
            currentCount = 0
        }
    }
    
    return result
}
```

} else if char == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, offsetBy: 0)
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == 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 = string.index(string.startIndex, offsetBy: 0)
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == substring {
            count += 1
            index += substring.count
        } else {
            index += 1
        }
    }
    return count
}
```

index += substring.count // 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 = string.startIndex
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == 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 = string.startIndex
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == substring {
            count += 1
            index += substring.count
        } else {
            index += 1
        }
    }
    return count
}
```

index += substring.count // 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 = string.index(string.startIndex, offsetBy: 0)
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == 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 = string.index(string.startIndex, offsetBy: 0)
    while index < string.endIndex {
        if string[index...].prefix(substring.count) == substring {
            count += 1
            index += substring.count
        } else {
            index += 1
        }
    }
    return count
}
```

index += substring.count // 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 = string.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: 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.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: index!)
    }
    return count
}
```

var index = string.index(of: substring) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index!) // extra argument 'at' in call
index = string.index(of: substring, at: index!) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: 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.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: index)
    }
    return count
}
```

var index = string.index(of: substring) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // extra argument 'at' in call

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: 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.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: index)
    }
    return count
}
```

var index = string.index(of: substring) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // extra argument 'at' in call

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: 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.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: index)
    }
    return count
}
```

var index = string.index(of: substring) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // extra argument 'at' in call

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

if string[i...i + substring.count - 1] == substring { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: 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.index(of: substring)
    while index != nil {
        count += 1
        index = string.index(after: index!)
        index = string.index(of: substring, at: index)
    }
    return count
}
```

var index = string.index(of: substring) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
index = string.index(of: substring, at: index) // extra argument 'at' in call

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, offsetBy: 0)
    while index != string.endIndex {
        if string[index...string.index(after: index)] == substring {
            count += 1
            index = string.index(after: index)
        } else {
            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.index(string.startIndex, offsetBy: 0)
    while index != string.endIndex {
        if string[index...string.index(after: index)] == substring {
            count += 1
            index = string.index(after: index)
        } else {
            index = string.index(after: index)
        }
    }
    return count
}
```

 // Fatal error: String index is out of bounds

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.split(separator: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.split(separator: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```
let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! } // type '(String, String) -> Bool' cannot conform to 'SortComparator'
let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! } // instance method 'sorted(using:)' requires the types 'String.SubSequence' (aka 'Substring') and '((String, String) -> Bool).Compared' be equivalent

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4,
        "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}

// Test cases
print(sortNumbers(numbers: "three one five")) // Output: "one three five"
print(sortNumbers(numbers: "nine eight seven")) // Output: "seven eight nine"
print(sortNumbers(numbers: "four two six")) // Output: "two four six"
print(sortNumbers(numbers: "zero one nine")) // Output: "one nine zero"
print(sortNumbers(numbers: "five four three")) // Output: "three four five"
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.split(separator: " ").map { String($0) }
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = [
        "zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9
    ]
    
    let numberArray = numbers.split(separator: " ").map { String($0) }
    let sortedNumbers = numberArray.sorted { numberMap[$0]! < numberMap[$1]! }
    
    return sortedNumbers.joined(separator: " ")
}
```

func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.split(separator: " ").map { String($0) }
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberMap: [String: Int] = ["zero": 0, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9]
    let numbersArray = numbers.split(separator: " ").map { String($0) }
    let sortedNumbers = numbersArray.sorted { numberMap[$0]! < numberMap[$1]! }
    return sortedNumbers.joined(separator: " ")
}
```

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```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 closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```

var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'
var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair = (Double.max, Double.min)
    var smallestDifference = Double.max
    
    for i in 0..<numbers.count - 1 {
        let currentDifference = abs(numbers[i] - numbers[i + 1])
        if currentDifference < smallestDifference {
            smallestDifference = currentDifference
            closestPair = (numbers[i], numbers[i + 1])
        }
    }
    
    return closestPair
}
```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) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair = (Double.max, Double.min)
    var smallestDifference = Double.max
    
    for i in 0..<numbers.count - 1 {
        let currentDifference = abs(numbers[i] - numbers[i + 1])
        if currentDifference < smallestDifference {
            smallestDifference = currentDifference
            closestPair = (numbers[i], numbers[i + 1])
        }
    }
    
    return closestPair
}
```

var closestPair = (Double.max, Double.min) // type 'Double' has no member 'min'
var closestPair = (Double.max, Double.min) // type 'Double' has no member 'max'
var smallestDifference = Double.max // type 'Double' has no member 'max'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let difference: Double = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```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 closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let difference: Double = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```

 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closestPair = (Double.max, Double.min)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, (numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```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 closestPair = (Double.max, Double.min)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, (numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```
var closestPair = (Double.max, Double.min) // type 'Double' has no member 'max'
var closestPair = (Double.max, Double.min) // type 'Double' has no member 'min'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```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 closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```

var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'
var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```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 closestPair = (Double.max, Double.max)
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let distance = abs(numbers[i] - numbers[j])
            if distance < closestPair.0 {
                closestPair = (distance, min(numbers[i], numbers[j]))
            }
        }
    }
    return closestPair
}
```
var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'
var closestPair = (Double.max, Double.max) // type 'Double' has no member 'max'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```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) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i+1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```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) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var minDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i+1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < minDifference {
                minDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```

 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair = (numbers[0], numbers[1])
    var smallestDifference = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < smallestDifference {
                smallestDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```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) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair = (numbers[0], numbers[1])
    var smallestDifference = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let difference = abs(numbers[i] - numbers[j])
            if difference < smallestDifference {
                smallestDifference = difference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var smallestDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i+1..<numbers.count {
            let currentDifference = abs(numbers[i] - numbers[j])
            if currentDifference < smallestDifference {
                smallestDifference = currentDifference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```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) {
    guard numbers.count >= 2 else {
        fatalError("Array must have at least two elements")
    }
    
    var closestPair: (Double, Double) = (numbers[0], numbers[1])
    var smallestDifference: Double = abs(numbers[0] - numbers[1])
    
    for i in 0..<numbers.count - 1 {
        for j in i+1..<numbers.count {
            let currentDifference = abs(numbers[i] - numbers[j])
            if currentDifference < smallestDifference {
                smallestDifference = currentDifference
                closestPair = (numbers[i], numbers[j])
            }
        }
    }
    
    return closestPair
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

return values.filter { $0 is Int } // cannot convert return expression of type '[AnyHashable]' to return type '[Int]'

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

func filterIntegers(values: [AnyHashable]) -> [Int] {
    var result: [Int] = []
    for value in values {
        if let intValue = value as? Int {
            result.append(intValue)
        }
    }
    return result
}
```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] {
    var result: [Int] = []
    for value in values {
        if let intValue = value as? Int {
            result.append(intValue)
        }
    }
    return result
}
```

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

return values.filter { $0 is Int } // cannot convert return expression of type '[AnyHashable]' to return type '[Int]'

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

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

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

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

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.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] {
    var result: [Int] = []
    for value in values {
        if let intValue = value as? Int {
            result.append(intValue)
        }
    }
    return result
}
```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] {
    var result: [Int] = []
    for value in values {
        if let intValue = value as? Int {
            result.append(intValue)
        }
    }
    return result
}
```

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

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

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

func strlen(string: String) -> Int {
    return string.count
}

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

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

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

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

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

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

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

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

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

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

// For a given number n, find the smallest number that divides n evenly, larger than n
// smallestDivisor(n: 15) == 16
func smallestDivisor(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 divisor = n - 1
    while divisor > 1 {
        if n % divisor == 0 {
            return divisor
        }
        divisor -= 1
    }
    return 1
}

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

// For a given number n, find the smallest number that divides n evenly, larger than n
// smallestDivisor(n: 15) == 16
func smallestDivisor(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 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 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 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 {
    for i in stride(from: n - 1, to: 0, by: -1) {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    for i in stride(from: n - 1, to: 0, by: -1) {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```

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

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

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

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

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

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

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

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

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 result = [Int]()
    var n = n
    var i = 2
    while n > 1 {
        while n % i == 0 {
            result.append(i)
            n /= i
        }
        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 n = n
    var i = 2
    while n > 1 {
        while n % i == 0 {
            result.append(i)
            n /= i
        }
        i += 1
    }
    return result
}
```

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

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

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while 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 removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = Set<Int>()
    for num in numbers {
        if !seen.contains(num) {
            result.append(num)
            seen.insert(num)
        }
    }
    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 num in numbers {
        if !seen.contains(num) {
            result.append(num)
            seen.insert(num)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

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

// Test cases
print(flipCase(string: "Hello")) // "hELLO"
print(flipCase(string: "Python")) // "pYTHON"
print(flipCase(string: "123")) // "123"
print(flipCase(string: "aBcDeF")) // "AbCdEf"
```

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

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

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

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

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

// Test cases
print(flipCase(string: "Hello")) // "hELLO"
print(flipCase(string: "WORLD")) // "world"
print(flipCase(string: "Python")) // "pYTHON"
```

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

// Test cases
print(flipCase(string: "Hello")) // "hELLO"
print(flipCase(string: "Python")) // "pYTHON"
print(flipCase(string: "123")) // "123"
print(flipCase(string: "aBcDeF")) // "AbCdEf"
```

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

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

func concatenate(strings: [String]) -> String {
    return strings.joined()
}
```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()
}
```

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

func concatenate(strings: [String]) -> String {
    return strings.joined()
}

func split(string: String, delimiter: String) -> [String] {
    return string.components(separatedBy: delimiter)
}

func join(strings: [String], delimiter: String) -> String {
    return strings.joined(separator: delimiter)
}

func reverse(string: String) -> String {
    return String(string.reversed())
}

func isPalindrome(string: String) -> Bool {
    let reversedString = String(string.reversed())
    return string == reversedString
}

func toUpperCase(string: String) -> String {
    return string.uppercased()
}

func toLowerCase(string: String) -> String {
    return string.lowercased()
}

func removeWhitespace(string: String) -> String {
    return string.replacingOccurrences(of: "\\s+", with: "", options: .regularExpression)
}

func removePunctuation(string: String) -> String {
    let punctuationCharacters = CharacterSet(charactersIn: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
    return string.components(separatedBy: punctuationCharacters).joined()
}

func removeNonAlphanumeric(string: String) -> String {
    let alphanumericCharacters = CharacterSet.alphanumerics
    return string.components(separatedBy: alphanumericCharacters.inverted).joined()
}

func removeDuplicates(string: String) -> String {
    var seen = Set<Character>()
    var result = ""
    for char in string {
        if seen.insert(char).inserted {
            result.append(char)
        }
    }
    return result
}

func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet.inverted).joined()
}

func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}
```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()
}

// Split a string into an array of substrings using a delimiter
// split(string: "a,b,c", delimiter: ",") == ["a", "b", "c"]
func split(string: String, delimiter: String) -> [String] {
    return string.components(separatedBy: delimiter)
}

// Join an array of strings into a single string using a delimiter
// join(strings: ["a", "b", "c"], delimiter: ",") == "a,b,c"
func join(strings: [String], delimiter: String) -> String {
    return strings.joined(separator: delimiter)
}

// Reverse a string
// reverse("abc") == "cba"
func reverse(string: String) -> String {
    return String(string.reversed())
}

// Check if a string is a palindrome
// isPalindrome("racecar") == true
func isPalindrome(string: String) -> Bool {
    let reversedString = String(string.reversed())
    return string == reversedString
}

// Convert a string to uppercase
// toUpperCase("hello") == "HELLO"
func toUpperCase(string: String) -> String {
    return string.uppercased()
}

// Convert a string to lowercase
// toLowerCase("HELLO") == "hello"
func toLowerCase(string: String) -> String {
    return string.lowercased()
}

// Remove all whitespace from a string
// removeWhitespace("hello world") == "helloworld"
func removeWhitespace(string: String) -> String {
    return string.replacingOccurrences(of: "\\s+", with: "", options: .regularExpression)
}

// Remove all punctuation from a string
// removePunctuation("hello, world!") == "helloworld"
func removePunctuation(string: String) -> String {
    let punctuationCharacters = CharacterSet(charactersIn: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
    return string.components(separatedBy: punctuationCharacters).joined()
}

// Remove all non-alphanumeric characters from a string
// removeNonAlphanumeric("hello123") == "hello123"
func removeNonAlphanumeric(string: String) -> String {
    let alphanumericCharacters = CharacterSet.alphanumerics
    return string.components(separatedBy: alphanumericCharacters.inverted).joined()
}

// Remove all duplicate characters from a string
// removeDuplicates("hello") == "helo"
func removeDuplicates(string: String) -> String {
    var seen = Set<Character>()
    var result = ""
    for char in string {
        if seen.insert(char).inserted {
            result.append(char)
        }
    }
    return result
}

// Remove all characters from a string that are not in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet.inverted).joined()
}

// Remove all characters from a string that are in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}

// Remove all characters from a string that are in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}

// Remove all characters from a string that are in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}

// Remove all characters from a string that are in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}

// Remove all characters from a string that are in a given set of characters
// removeCharacters(string: "hello", characters: "aeiou") == "hll"
func removeCharacters(string: String, characters: String) -> String {
    let characterSet = CharacterSet(charactersIn: characters)
    return string.components(separatedBy: characterSet).joined()
}

// Remove all characters from a string that are in a given set
func removeCharacters(string: String, characters: String) -> String { // invalid redeclaration of 'removeCharacters(string:characters:)'

func concatenate(strings: [String]) -> String {
    return strings.joined()
}

func split(string: String, delimiter: String) -> [String] {
    return string.components(separatedBy: delimiter)
}

func join(strings: [String], delimiter: String) -> String {
    return strings.joined(separator: delimiter)
}

func reverse(string: String) -> String {
    return String(string.reversed())
}

func contains(string: String, substring: String) -> Bool {
    return string.contains(substring)
}

func replace(string: String, old: String, new: String) -> String {
    return string.replacingOccurrences(of: old, with: new)
}

func remove(string: String, substring: String) -> String {
    return string.replacingOccurrences(of: substring, with: "", options: .literal, range: nil)
}

func trim(string: String) -> String {
    return string.trimmingCharacters(in: .whitespacesAndNewlines)
}

func toLower(string: String) -> String {
    return string.lowercased()
}

func toUpper(string: String) -> String {
    return string.uppercased()
}

func toTitle(string: String) -> String {
    return string.capitalized
}

func toCamel(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "", options: .literal, range: nil).first?.lowercased() ?? ""
}

func toSnake(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "_", options: .literal, range: nil).lowercased()
}

func toKebab(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "-", options: .literal, range: nil).lowercased()
}

func toPascal(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "", options: .literal, range: nil).first?.capitalized ?? ""
}

func toDot(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: ".", options: .literal, range: nil).lowercased()
}

func toPath(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "/", options: .literal, range: nil).lowercased()
}
```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()
}

// Split a string into an array of substrings based on a delimiter
// split(string: "", delimiter: "") == []
// split(string: "a,b,c", delimiter: ",") == ["a", "b", "c"]
func split(string: String, delimiter: String) -> [String] {
    return string.components(separatedBy: delimiter)
}

// Join an array of strings into a single string with a delimiter
// join(strings: [], delimiter: "") == ""
// join(strings: ["a", "b", "c"], delimiter: ",") == "a,b,c"
func join(strings: [String], delimiter: String) -> String {
    return strings.joined(separator: delimiter)
}

// Reverse the order of characters in a string
// reverse(string: "") == ""
// reverse(string: "abc") == "cba"
func reverse(string: String) -> String {
    return String(string.reversed())
}

// Check if a string contains a substring
// contains(string: "", substring: "") == false
// contains(string: "abc", substring: "a") == true
func contains(string: String, substring: String) -> Bool {
    return string.contains(substring)
}

// Replace all occurrences of a substring in a string with another substring
// replace(string: "", old: "", new: "") == ""
// replace(string: "abc", old: "a", new: "x") == "xbc"
func replace(string: String, old: String, new: String) -> String {
    return string.replacingOccurrences(of: old, with: new)
}

// Remove all occurrences of a substring from a string
// remove(string: "", substring: "") == ""
// remove(string: "abc", substring: "a") == "bc"
func remove(string: String, substring: String) -> String {
    return string.replacingOccurrences(of: substring, with: "", options: .literal, range: nil)
}

// Trim leading and trailing whitespace from a string
// trim(string: "") == ""
// trim(string: "  abc  ") == "abc"
func trim(string: String) -> String {
    return string.trimmingCharacters(in: .whitespacesAndNewlines)
}

// Convert a string to lowercase
// toLower(string: "") == ""
// toLower(string: "ABC") == "abc"
func toLower(string: String) -> String {
    return string.lowercased()
}

// Convert a string to uppercase
// toUpper(string: "") == ""
// toUpper(string: "abc") == "ABC"
func toUpper(string: String) -> String {
    return string.uppercased()
}

// Convert a string to title case
// toTitle(string: "") == ""
// toTitle(string: "abc") == "Abc"
func toTitle(string: String) -> String {
    return string.capitalized
}

// Convert a string to camel case
// toCamel(string: "") == ""
// toCamel(string: "abc") == "abc"
func toCamel(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "", options: .literal, range: nil).first?.lowercased() ?? ""
}

// Convert a string to snake case
// toSnake(string: "") == ""
// toSnake(string: "abc") == "abc"
func toSnake(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "_", options: .literal, range: nil).lowercased()
}

// Convert a string to kebab case
// toKebab(string: "") == ""
// toKebab(string: "abc") == "abc"
func toKebab(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "-", options: .literal, range: nil).lowercased()
}

// Convert a string to Pascal case
// toPascal(string: "") == ""
// toPascal(string: "abc") == "Abc"
func toPascal(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "", options: .literal, range: nil).first?.capitalized ?? ""
}

// Convert a string to dot case
// toDot(string: "") == ""
// toDot(string: "abc") == "abc"
func toDot(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: ".", options: .literal, range: nil).lowercased()
}

// Convert a string to path case
// toPath(string: "") == ""
// toPath(string: "abc") == "abc"
func toPath(string: String) -> String {
    return string.replacingOccurrences(of: " ", with: "/", options: .literal, range: nil).lowercased()
}

// Convert a string to slug case
// toSlug(string: "") == ""
// toSlug(string
return string.replacingOccurrences(of: " ", with: "", options: .literal, range: nil).first?.capitalized ?? "" // value of type 'String.Element' (aka 'Character') has no member 'capitalized'

func concatenate(strings: [String]) -> String {
    return strings.joined()
}
```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()
}
```

func concatenate(strings: [String]) -> String {
    return strings.joined()
}
```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()
}
```

func concatenate(strings: [String]) -> String {
    return strings.joined()
}
```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()
}
```

func concatenate(strings: [String]) -> String {
    return strings.joined(separator: "")
}

func concatenate(strings: [String], separator: String) -> String {
    return strings.joined(separator: 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: "")
}

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

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

func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```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) }
}

// Filter an input array of strings only for ones that end with a given suffix.
// filterBySuffix(strings: [] as [String], suffix: "a") == [] as [String]
// filterBySuffix(strings: ["abc", "bcd", "cde", "array"], suffix: "a") == ["bcd", "cde", "array"]
func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

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

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

func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```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) }
}

// Filter an input array of strings only for ones that end with a given suffix.
// filterBySuffix(strings: [] as [String], suffix: "a") == [] as [String]
// filterBySuffix(strings: ["abc", "bcd", "cde", "array"], suffix: "a") == ["bcd", "cde"]
func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

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

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

func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```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) }
}

// Filter an input array of strings only for ones that end with a given suffix.
// filterBySuffix(strings: [] as [String], suffix: "a") == [] as [String]
// filterBySuffix(strings: ["abc", "bcd", "cde", "array"], suffix: "a") == ["bcd", "cde"]
func filterBySuffix(strings: [String], suffix: String) -> [String] {
    return strings.filter { $0.hasSuffix(suffix) }
}

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

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

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

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

func getPositive(l: [Int]) -> [Int] {
    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 {
    if n <= 1 { return false }
    if n <= 3 { return true }
    if n % 2 == 0 || n % 3 == 0 { return false }
    for i in stride(from: 5, to: Int(sqrt(Double(n))) + 1, by: 6) {
        if n % i == 0 || n % (i + 2) == 0 { return false }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    if n <= 1 { return false }
    if n <= 3 { return true }
    if n % 2 == 0 || n % 3 == 0 { return false }
    for i in stride(from: 5, to: Int(sqrt(Double(n))) + 1, by: 6) {
        if n % i == 0 || n % (i + 2) == 0 { return false }
    }
    return true
}
```

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

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

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

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

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

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

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

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

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

```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 l2 = l
    var l3 = l
    var l4 = l
    var l5 = l
    var l6 = l
    var l7 = l
    var l8 = l
    var l9 = l
    var l10 = l
    var l11 = l
    var l12 = l
    var l13 = l
    var l14 = l
    var l15 = l
    var l16 = l
    var l17 = l
    var l18 = l
    var l19 = l
    var l20 = l
    var l21 = l
    var l22 = l
    var l23 = l
    var l24 = l
    var l25 = l
    var l26 = l
    var l27 = l
    var l28 = l
    var l29 = l
    var l30 = l
    var l31 = l
    var l32 = l
    var l33 = l
    var l34 = l
    var l35 = l
    var l36 = l
    var l37 = l
    var l38 = l
    var l39 = l
    var l40 = l
    var l41 = l
    var l42 = l
    var l43 = l
    var l44 = l
    var l45 = l
    var l46 = l
    var l47 = l
    var l48 = l
    var l49 = l
    var l50 = l
    var l51 = l
    var l52 = l
    var l53 = l
    var l54 = l
    var l55 = l
    var l56 = l
    var l57 = l
    var l58 = l
    var l59 = l
    var l60 = l
    var l61 = l
    var l62 = l
    var l63 = l
    var l64 = l
    var l65 = l
    var l66 = l
    var l67 = l
    var l68 = l
    var l69 = l
    var l70 = l
    var l71 = l
    var l72 = l
    var l73 = l
    var l74 = l
    var l75 = l
    var l76 = l
    var l77 = l
    var l78 = l
    var l79 = l
    var l80 = l
    var l81 = l
    var l82 = l
    var l83 = l
    var l84 = l
    var l85 = l
    var l86 = l
    var l87 = l
    var l88 = l
    var l89 = l
    var l90 = l
    var l91 = l
    var l92 = l
    var l93 = l
    var l94 = l
    var l95 = l
    var l96 = l
    var l97 = l
    var l98 = l
    var l99 = l
    var l100 = l
    var l101 = l
    var l102 = l
    var l103 = l
    var l104 = l
    var l105 = l
    var l106 = l
    var l107 = l
    var l108 = l
    var l109 = l
    var l110 = l
    var l111 = l
    var l112 = l
    var l113 = l
    var l114 = l
    var l115 = l
    var l116 = l
    var l117 = l
    var l118 = l
    var l119 = l
    var l120 = l
    var l121 = l
    var l122 = l
    var l123 = l
    var l124 = l
    var l125 = l
    var l126 =
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]) // cannot find 'sortThird' in scope

func sortThird(l: [Int]) -> [Int] {
    var l = l
    let indices = l.indices.filter { $0 % 3 == 0 }
    let values = l.indices.filter { $0 % 3 != 0 }.map { l[$0] }
    let sortedValues = values.sorted()
    for (i, v) in sortedValues.enumerated() {
        l[indices[i]] = v
    }
    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 indices = l.indices.filter { $0 % 3 == 0 }
    let values = l.indices.filter { $0 % 3 != 0 }.map { l[$0] }
    let sortedValues = values.sorted()
    for (i, v) in sortedValues.enumerated() {
        l[indices[i]] = v
    }
    return l
}
```

 // Fatal error: Index out of range

func sortThird(l: [Int]) -> [Int] {
    var l = l
    var l3 = l.filter { $0 % 3 == 0 }
    l3.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l3[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
    var l3 = l.filter { $0 % 3 == 0 }
    l3.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l3[i / 3]
    }
    return l
}
```

 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    var l3 = l.filter { $0 % 3 == 0 }
    l3.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l3[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
    var l3 = l.filter { $0 % 3 == 0 }
    l3.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l3[i / 3]
    }
    return l
}
```

 // XCTAssertTrue failed

```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 thirdIndex = l.count / 3
    let thirdIndex2 = 2 * thirdIndex
    let thirdIndex3 = 3 * thirdIndex
    let thirdIndex4 = 4 * thirdIndex
    let thirdIndex5 = 5 * thirdIndex
    let thirdIndex6 = 6 * thirdIndex
    let thirdIndex7 = 7 * thirdIndex
    let thirdIndex8 = 8 * thirdIndex
    let thirdIndex9 = 9 * thirdIndex
    let thirdIndex10 = 10 * thirdIndex
    let thirdIndex11 = 11 * thirdIndex
    let thirdIndex12 = 12 * thirdIndex
    let thirdIndex13 = 13 * thirdIndex
    let thirdIndex14 = 14 * thirdIndex
    let thirdIndex15 = 15 * thirdIndex
    let thirdIndex16 = 16 * thirdIndex
    let thirdIndex17 = 17 * thirdIndex
    let thirdIndex18 = 18 * thirdIndex
    let thirdIndex19 = 19 * thirdIndex
    let thirdIndex20 = 20 * thirdIndex
    let thirdIndex21 = 21 * thirdIndex
    let thirdIndex22 = 22 * thirdIndex
    let thirdIndex23 = 23 * thirdIndex
    let thirdIndex24 = 24 * thirdIndex
    let thirdIndex25 = 25 * thirdIndex
    let thirdIndex26 = 26 * thirdIndex
    let thirdIndex27 = 27 * thirdIndex
    let thirdIndex28 = 28 * thirdIndex
    let thirdIndex29 = 29 * thirdIndex
    let thirdIndex30 = 30 * thirdIndex
    let thirdIndex31 = 31 * thirdIndex
    let thirdIndex32 = 32 * thirdIndex
    let thirdIndex33 = 33 * thirdIndex
    let thirdIndex34 = 34 * thirdIndex
    let thirdIndex35 = 35 * thirdIndex
    let thirdIndex36 = 36 * thirdIndex
    let thirdIndex37 = 37 * thirdIndex
    let thirdIndex38 = 38 * thirdIndex
    let thirdIndex39 = 39 * thirdIndex
    let thirdIndex40 = 40 * thirdIndex
    let thirdIndex41 = 41 * thirdIndex
    let thirdIndex42 = 42 * thirdIndex
    let thirdIndex43 = 43 * thirdIndex
    let thirdIndex44 = 44 * thirdIndex
    let thirdIndex45 = 45 * thirdIndex
    let thirdIndex46 = 46 * thirdIndex
    let thirdIndex47 = 47 * thirdIndex
    let thirdIndex48 = 48 * thirdIndex
    let thirdIndex49 = 49 * thirdIndex
    let thirdIndex50 = 50 * thirdIndex
    let thirdIndex51 = 51 * thirdIndex
    let thirdIndex52 = 52 * thirdIndex
    let thirdIndex53 = 53 * thirdIndex
    let thirdIndex54 = 54 * thirdIndex
    let thirdIndex55 = 55 * thirdIndex
    let thirdIndex56 = 56 * thirdIndex
    let thirdIndex57 = 57 * thirdIndex
    let thirdIndex58 = 58 * thirdIndex
    let thirdIndex59 = 59 * thirdIndex
    let thirdIndex60 = 60 * thirdIndex
    let thirdIndex61 = 61 * thirdIndex
    let thirdIndex62 = 62 * thirdIndex
    let thirdIndex63 = 63 * thirdIndex
    let thirdIndex64 = 64 * thirdIndex
    let thirdIndex65 = 65 * thirdIndex
    let thirdIndex66 = 66 * thirdIndex
    let thirdIndex67 = 67 * thirdIndex
    let thirdIndex68 = 68 * thirdIndex
    let thirdIndex69 = 69 * thirdIndex
    let thirdIndex70 = 70 * thirdIndex
    let thirdIndex71 = 71 * thirdIndex
    let thirdIndex72 = 72 * thirdIndex
    let thirdIndex73 = 73 * thirdIndex
    let thirdIndex74 = 74 * thirdIndex
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]) // cannot find 'sortThird' in scope

```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 l2 = l
    var l3 = l
    var l4 = l
    var l5 = l
    var l6 = l
    var l7 = l
    var l8 = l
    var l9 = l
    var l10 = l
    var l11 = l
    var l12 = l
    var l13 = l
    var l14 = l
    var l15 = l
    var l16 = l
    var l17 = l
    var l18 = l
    var l19 = l
    var l20 = l
    var l21 = l
    var l22 = l
    var l23 = l
    var l24 = l
    var l25 = l
    var l26 = l
    var l27 = l
    var l28 = l
    var l29 = l
    var l30 = l
    var l31 = l
    var l32 = l
    var l33 = l
    var l34 = l
    var l35 = l
    var l36 = l
    var l37 = l
    var l38 = l
    var l39 = l
    var l40 = l
    var l41 = l
    var l42 = l
    var l43 = l
    var l44 = l
    var l45 = l
    var l46 = l
    var l47 = l
    var l48 = l
    var l49 = l
    var l50 = l
    var l51 = l
    var l52 = l
    var l53 = l
    var l54 = l
    var l55 = l
    var l56 = l
    var l57 = l
    var l58 = l
    var l59 = l
    var l60 = l
    var l61 = l
    var l62 = l
    var l63 = l
    var l64 = l
    var l65 = l
    var l66 = l
    var l67 = l
    var l68 = l
    var l69 = l
    var l70 = l
    var l71 = l
    var l72 = l
    var l73 = l
    var l74 = l
    var l75 = l
    var l76 = l
    var l77 = l
    var l78 = l
    var l79 = l
    var l80 = l
    var l81 = l
    var l82 = l
    var l83 = l
    var l84 = l
    var l85 = l
    var l86 = l
    var l87 = l
    var l88 = l
    var l89 = l
    var l90 = l
    var l91 = l
    var l92 = l
    var l93 = l
    var l94 = l
    var l95 = l
    var l96 = l
    var l97 = l
    var l98 = l
    var l99 = l
    var l100 = l
    var l101 = l
    var l102 = l
    var l103 = l
    var l104 = l
    var l105 = l
    var l106 = l
    var l107 = l
    var l108 = l
    var l109 = l
    var l110 = l
    var l111 = l
    var l112 = l
    var l113 = l
    var l114 = l
    var l115 = l
    var l116 = l
    var l117 = l
    var l118 = l
    var l119 = l
    var l120 = l
    var l121 = l
    var l122 = l
    var l123 = l
    var l124 = l
    var l125 = l
    var l126 =
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]) // cannot find 'sortThird' in scope

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

```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 thirdIndex = l.count / 3
    let thirdIndex2 = 2 * thirdIndex
    let thirdIndex3 = 3 * thirdIndex
    let thirdIndex4 = 4 * thirdIndex
    let thirdIndex5 = 5 * thirdIndex
    let thirdIndex6 = 6 * thirdIndex
    let thirdIndex7 = 7 * thirdIndex
    let thirdIndex8 = 8 * thirdIndex
    let thirdIndex9 = 9 * thirdIndex
    let thirdIndex10 = 10 * thirdIndex
    let thirdIndex11 = 11 * thirdIndex
    let thirdIndex12 = 12 * thirdIndex
    let thirdIndex13 = 13 * thirdIndex
    let thirdIndex14 = 14 * thirdIndex
    let thirdIndex15 = 15 * thirdIndex
    let thirdIndex16 = 16 * thirdIndex
    let thirdIndex17 = 17 * thirdIndex
    let thirdIndex18 = 18 * thirdIndex
    let thirdIndex19 = 19 * thirdIndex
    let thirdIndex20 = 20 * thirdIndex
    let thirdIndex21 = 21 * thirdIndex
    let thirdIndex22 = 22 * thirdIndex
    let thirdIndex23 = 23 * thirdIndex
    let thirdIndex24 = 24 * thirdIndex
    let thirdIndex25 = 25 * thirdIndex
    let thirdIndex26 = 26 * thirdIndex
    let thirdIndex27 = 27 * thirdIndex
    let thirdIndex28 = 28 * thirdIndex
    let thirdIndex29 = 29 * thirdIndex
    let thirdIndex30 = 30 * thirdIndex
    let thirdIndex31 = 31 * thirdIndex
    let thirdIndex32 = 32 * thirdIndex
    let thirdIndex33 = 33 * thirdIndex
    let thirdIndex34 = 34 * thirdIndex
    let thirdIndex35 = 35 * thirdIndex
    let thirdIndex36 = 36 * thirdIndex
    let thirdIndex37 = 37 * thirdIndex
    let thirdIndex38 = 38 * thirdIndex
    let thirdIndex39 = 39 * thirdIndex
    let thirdIndex40 = 40 * thirdIndex
    let thirdIndex41 = 41 * thirdIndex
    let thirdIndex42 = 42 * thirdIndex
    let thirdIndex43 = 43 * thirdIndex
    let thirdIndex44 = 44 * thirdIndex
    let thirdIndex45 = 45 * thirdIndex
    let thirdIndex46 = 46 * thirdIndex
    let thirdIndex47 = 47 * thirdIndex
    let thirdIndex48 = 48 * thirdIndex
    let thirdIndex49 = 49 * thirdIndex
    let thirdIndex50 = 50 * thirdIndex
    let thirdIndex51 = 51 * thirdIndex
    let thirdIndex52 = 52 * thirdIndex
    let thirdIndex53 = 53 * thirdIndex
    let thirdIndex54 = 54 * thirdIndex
    let thirdIndex55 = 55 * thirdIndex
    let thirdIndex56 = 56 * thirdIndex
    let thirdIndex57 = 57 * thirdIndex
    let thirdIndex58 = 58 * thirdIndex
    let thirdIndex59 = 59 * thirdIndex
    let thirdIndex60 = 60 * thirdIndex
    let thirdIndex61 = 61 * thirdIndex
    let thirdIndex62 = 62 * thirdIndex
    let thirdIndex63 = 63 * thirdIndex
    let thirdIndex64 = 64 * thirdIndex
    let thirdIndex65 = 65 * thirdIndex
    let thirdIndex66 = 66 * thirdIndex
    let thirdIndex67 = 67 * thirdIndex
    let thirdIndex68 = 68 * thirdIndex
    let thirdIndex69 = 69 * thirdIndex
    let thirdIndex70 = 70 * thirdIndex
    let thirdIndex71 = 71 * thirdIndex
    let thirdIndex72 = 72 * thirdIndex
    let thirdIndex73 = 73 * thirdIndex
    let thirdIndex74 = 74 * thirdIndex
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]) // cannot find 'sortThird' in scope

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

```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 l2 = l
    var l3 = l
    var l4 = l
    var l5 = l
    var l6 = l
    var l7 = l
    var l8 = l
    var l9 = l
    var l10 = l
    var l11 = l
    var l12 = l
    var l13 = l
    var l14 = l
    var l15 = l
    var l16 = l
    var l17 = l
    var l18 = l
    var l19 = l
    var l20 = l
    var l21 = l
    var l22 = l
    var l23 = l
    var l24 = l
    var l25 = l
    var l26 = l
    var l27 = l
    var l28 = l
    var l29 = l
    var l30 = l
    var l31 = l
    var l32 = l
    var l33 = l
    var l34 = l
    var l35 = l
    var l36 = l
    var l37 = l
    var l38 = l
    var l39 = l
    var l40 = l
    var l41 = l
    var l42 = l
    var l43 = l
    var l44 = l
    var l45 = l
    var l46 = l
    var l47 = l
    var l48 = l
    var l49 = l
    var l50 = l
    var l51 = l
    var l52 = l
    var l53 = l
    var l54 = l
    var l55 = l
    var l56 = l
    var l57 = l
    var l58 = l
    var l59 = l
    var l60 = l
    var l61 = l
    var l62 = l
    var l63 = l
    var l64 = l
    var l65 = l
    var l66 = l
    var l67 = l
    var l68 = l
    var l69 = l
    var l70 = l
    var l71 = l
    var l72 = l
    var l73 = l
    var l74 = l
    var l75 = l
    var l76 = l
    var l77 = l
    var l78 = l
    var l79 = l
    var l80 = l
    var l81 = l
    var l82 = l
    var l83 = l
    var l84 = l
    var l85 = l
    var l86 = l
    var l87 = l
    var l88 = l
    var l89 = l
    var l90 = l
    var l91 = l
    var l92 = l
    var l93 = l
    var l94 = l
    var l95 = l
    var l96 = l
    var l97 = l
    var l98 = l
    var l99 = l
    var l100 = l
    var l101 = l
    var l102 = l
    var l103 = l
    var l104 = l
    var l105 = l
    var l106 = l
    var l107 = l
    var l108 = l
    var l109 = l
    var l110 = l
    var l111 = l
    var l112 = l
    var l113 = l
    var l114 = l
    var l115 = l
    var l116 = l
    var l117 = l
    var l118 = l
    var l119 = l
    var l120 = l
    var l121 = l
    var l122 = l
    var l123 = l
    var l124 = l
    var l125 = l
    var l126 =
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]) // cannot find 'sortThird' in scope
XCTAssertTrue(sortThird(l: [5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]) // cannot find 'sortThird' in scope

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

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

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

 // XCTAssertTrue failed

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

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var unique = Set<Int>()
    for i in l {
        unique.insert(i)
    }
    return Array(unique)
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in l {
        if i < min {
            min = i
        }
    }
    return min
}

func sum(l: [Int]) -> Int {
    var sum = 0
    for i in l {
        sum += i
    }
    return sum
}

func product(l: [Int]) -> Int {
    var product = 1
    for i in l {
        product *= i
    }
    return product
}

func average(l: [Int]) -> Double {
    var sum = 0
    for i in l {
        sum += i
    }
    return Double(sum) / Double(l.count)
}

func median(l: [Int]) -> Int {
    var sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return (sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return sorted[middle]
    }
}

func mode(l: [Int]) -> Int {
    var counts = [Int: Int]()
    for i in l {
        if let count = counts[i] {
            counts[i] = count + 1
        } else {
            counts[i] = 1
        }
    }
    var maxCount = 0
    var mode = 0
    for (key, value) in counts {
        if value > maxCount {
            maxCount = value
            mode = key
        }
    }
    return mode
}

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

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

// Return sum of all elements in the array.
// sum(l: [1, 2, 3]) == 6
// sum(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 124
func sum(l: [Int]) -> Int {
    var sum = 0
    for i in l {
        sum += i
    }
    return sum
}

// Return product of all elements in the array.
// product(l: [1, 2, 3]) == 6
// product(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 0
func product(l: [Int]) -> Int {
    var product = 1
    for i in l {
        product *= i
    }
    return product
}

// Return average of all elements in the array.
// average(l: [1, 2, 3]) == 2
// average(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 16
func average(l: [Int]) -> Double {
    var sum = 0
    for i in l {
        sum += i
    }
    return Double(sum) / Double(l.count)
}

// Return median of all elements in the array.
// median(l: [1, 2, 3]) == 2
// median(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 3
func median(l: [Int]) -> Int {
    var sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return (sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return sorted[middle]
    }
}

// Return mode of all elements in the array.
// mode(l: [1, 2, 3]) == 1
// mode(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 3
func mode(l: [Int]) -> Int {
    var counts = [Int: Int]()
    for i in l {
        if let count = counts[i] {
            counts[i] = count + 1
        } else {
            counts[i] = 1
        }
    }
    var maxCount = 0
    var mode = 0
    for (key, value) in counts {
        if value > maxCount {
            maxCount = value
            mode = key
        }
    }
    return mode
}

// Return range of all elements in the array.
// range(l: [1, 2, 3]) == 2
// range(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 128
func range(l: [Int]) -> Int {
    var sorted = l.sorted()
    return sorted[sorted.count - 1] - sorted[0]
}

// Return standard deviation of all elements in the array.
// standardDeviation(l: [1, 2, 3]) == 1.0
// standardDeviation(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 12.91
func standardDeviation(l: [Int]) -> Double {
    var sum = 0
    for i in l {
        sum += i
    }
   
var sorted = l.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
var sorted = l.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

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

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

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

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

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

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l = l
    let even = l.enumerated().filter { $0.offset % 2 == 0 }.map { $0.element }
    let odd = l.enumerated().filter { $0.offset % 2 == 1 }.map { $0.element }
    return even.sorted() + odd
}
```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.enumerated().filter { $0.offset % 2 == 0 }.map { $0.element }
    let odd = l.enumerated().filter { $0.offset % 2 == 1 }.map { $0.element }
    return even.sorted() + odd
}
```
var l = l // variable 'l' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the 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 even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```

 // Fatal error: Can't remove first element from an empty collection

func sortEven(l: [Int]) -> [Int] {
    var even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the 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 even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```

 // Fatal error: Can't remove first element from an empty collection

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

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

func sortEven(l: [Int]) -> [Int] {
    var even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the 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 even = l.filter { $0 % 2 == 0 }
    even.sort()
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(even.removeFirst())
        } else {
            result.append(l[i])
        }
    }
    return result
}
```

 // Fatal error: Can't remove first element from an empty collection

func sortEven(l: [Int]) -> [Int] {
    var l = l
    var even = l.enumerated().filter { $0.offset % 2 == 0 }.map { $0.element }
    even.sort()
    for (i, e) in even.enumerated() {
        l[i * 2] = e
    }
    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
    var even = l.enumerated().filter { $0.offset % 2 == 0 }.map { $0.element }
    even.sort()
    for (i, e) in even.enumerated() {
        l[i * 2] = e
    }
    return l
}
```

func sortEven(l: [Int]) -> [Int] {
    var l = l
    var even = l.filter { $0 % 2 == 0 }
    even.sort()
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = even[i/2]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the 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
    var even = l.filter { $0 % 2 == 0 }
    even.sort()
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = even[i/2]
        }
    }
    return l
}
```
 // Fatal error: Index out of range

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

var even = l.filter { $0 % 2 == 0 }.sorted() // variable 'even' was never mutated; consider changing to 'let' constant
var odd = l.filter { $0 % 2 != 0 } // variable 'odd' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

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

 // Fatal error: Can't remove first element from an empty collection

func primeFib(n: Int) -> Int {
    var fib = [1, 1]
    var i = 2
    while fib.count <= n {
        let next = fib[i - 1] + fib[i - 2]
        fib.append(next)
        i += 1
    }
    return fib[n]
}
```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]
    var i = 2
    while fib.count <= n {
        let next = fib[i - 1] + fib[i - 2]
        fib.append(next)
        i += 1
    }
    return fib[n]
}
```
 // XCTAssertTrue failed

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

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

// isPrime checks if a number is prime.
func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```

 // XCTAssertTrue failed

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

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

// isPrime checks if a number is prime.
func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```

 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var count = 0
    var fib = 0
    var i = 0
    while count < n {
        fib = fibonacci(i)
        if isPrime(fib) {
            count += 1
        }
        i += 1
    }
    return fib
}

func fibonacci(n: Int) -> Int {
    if n == 1 || n == 2 {
        return 1
    }
    return fibonacci(n: n - 1) + fibonacci(n: n - 2)
}

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

// fibonacci returns the nth Fibonacci number.
// fibonacci(n: 1) == 1
// fibonacci(n: 2) == 1
// fibonacci(n: 3) == 2
// fibonacci(n: 4) == 3
// fibonacci(n: 5) == 5
func fibonacci(n: Int) -> Int {
    if n == 1 || n == 2 {
        return 1
    }
    return fibonacci(n: n - 1) + fibonacci(n: n - 2)
}

// isPrime checks if a number is prime.
// isPrime(n: 2) == true
// isPrime(n: 3) == true
// isPrime(n: 4) == false
// isPrime(n: 5) == true
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

fib = fibonacci(i) // missing argument label 'n:' in call
if isPrime(fib) { // missing argument label 'n:' in call

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

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

// isPrime checks if a number is prime.
// isPrime(number: 2) == true
// isPrime(number: 3) == true
// isPrime(number: 4) == false
// isPrime(number: 5) == true
func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```

 // XCTAssertTrue failed

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

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

// isPrime checks if a number is prime.
func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

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

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

// isPrime checks if a number is prime.
// isPrime(number: 2) == true
// isPrime(number: 3) == true
// isPrime(number: 4) == false
// isPrime(number: 5) == true
func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

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

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

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

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

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

// isPrime checks if a number is prime.
// isPrime(number: 2) == true
// isPrime(number: 3) == true
// isPrime(number: 4) == false
func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```

 // XCTAssertTrue failed

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

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

// isPrime checks if a number is prime.
// isPrime(number: 2) == true
// isPrime(number: 3) == true
// isPrime(number: 4) == false
// isPrime(number: 5) == true
func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```

func triplesSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for (i, a) in l.enumerated() {
        for b in l[i+1...] {
            let c = -a - b
            if seen.contains(c) {
                return true
            }
            seen.insert(b)
        }
    }
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for (i, a) in l.enumerated() {
        for b in l[i+1...] {
            let c = -a - b
            if seen.contains(c) {
                return true
            }
            seen.insert(b)
        }
    }
    return false
}
```
for b in l[i+1...] { // for-in loop requires 'Int' to conform to 'Sequence'
for b in l[i+1...] { // cannot convert value of type 'PartialRangeFrom<Int>' to expected argument type 'Int'

func triplesSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for (i, a) in l.enumerated() {
        for b in l[i+1...] {
            let c = -a - b
            if seen.contains(c) {
                return true
            }
            seen.insert(b)
        }
    }
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for (i, a) in l.enumerated() {
        for b in l[i+1...] {
            let c = -a - b
            if seen.contains(c) {
                return true
            }
            seen.insert(b)
        }
    }
    return false
}
```
for b in l[i+1...] { // for-in loop requires 'Int' to conform to 'Sequence'
for b in l[i+1...] { // cannot convert value of type 'PartialRangeFrom<Int>' to expected argument type 'Int'

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

func triplesSumToZero(l: [Int]) -> Bool {
    let sorted = l.sorted()
    for i in 0..<sorted.count-2 {
        var left = i + 1
        var right = sorted.count - 1
        while left < right {
            let sum = sorted[i] + sorted[left] + sorted[right]
            if sum == 0 {
                return true
            } else if sum < 0 {
                left += 1
            } else {
                right -= 1
            }
        }
    }
    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 {
    let sorted = l.sorted()
    for i in 0..<sorted.count-2 {
        var left = i + 1
        var right = sorted.count - 1
        while left < right {
            let sum = sorted[i] + sorted[left] + sorted[right]
            if sum == 0 {
                return true
            } else if sum < 0 {
                left += 1
            } else {
                right -= 1
            }
        }
    }
    return false
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                    break
                }
            }
        }
    }
    return result
}
```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
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                    break
                }
            }
        }
    }
    return result
}
```

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

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

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                }
            }
        }
    }
    return result
}
```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
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                }
            }
        }
    }
    return result
}
```

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

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                    break
                }
            }
        }
    }
    return result
}
```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
    var result = false
    for i in 0..<l.count {
        for j in i+1..<l.count {
            for k in j+1..<l.count {
                if l[i] + l[j] + l[k] == 0 {
                    result = true
                    break
                }
            }
        }
    }
    return result
}
```

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    var cars = Array(repeating: 0, count: n)
    for i in 0..<n {
        if cars[i] == 0 {
            var j = i
            while j < n && cars[j] == 0 {
                j += 1
            }
            if j < n && j != i {
                cars[i] = 1
                cars[j] = 1
                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
    var cars = Array(repeating: 0, count: n)
    for i in 0..<n {
        if cars[i] == 0 {
            var j = i
            while j < n && cars[j] == 0 {
                j += 1
            }
            if j < n && j != i {
                cars[i] = 1
                cars[j] = 1
                collisions += 1
            }
        }
    }
    return collisions
}
```

 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    var leftCars = [Int]()
    var rightCars = [Int]()
    
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars.append(i)
        } else {
            rightCars.append(i)
        }
    }
    
    while !leftCars.isEmpty && !rightCars.isEmpty {
        let leftCar = leftCars.removeFirst()
        let rightCar = rightCars.removeLast()
        
        if leftCar < rightCar {
            collisions += 1
        } else {
            leftCars.append(leftCar)
            rightCars.append(rightCar)
        }
    }
    
    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
    var leftCars = [Int]()
    var rightCars = [Int]()
    
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars.append(i)
        } else {
            rightCars.append(i)
        }
    }
    
    while !leftCars.isEmpty && !rightCars.isEmpty {
        let leftCar = leftCars.removeFirst()
        let rightCar = rightCars.removeLast()
        
        if leftCar < rightCar {
            collisions += 1
        } else {
            leftCars.append(leftCar)
            rightCars.append(rightCar)
        }
    }
    
    return collisions
}
```

 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    // The number of collisions is equal to the number of cars that are driving in the same direction.
    return n
}
```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 {
    // The number of collisions is equal to the number of cars that are driving in the same direction.
    return n
}
```

 // XCTAssertTrue failed

```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    for i in 0..<n {
        for j in 0..<n {
            if i != j && i < j {
                if i < 0 || j < 0 {
                    continue
                }
                if i > j {
                    continue
                }
                if i == j {
                    continue
                }
                if i > 0 && j > 0 {
                    continue
                }
                if i < 0 && j < 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j > 0 {
                    continue
                }
                if i > 0 && j == 0 {
                    continue
                }
                if i == 0 && j < 0 {
                    continue
                }
                if i < 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
                }
                if i == 0 && j == 0 {
                    continue
XCTAssertTrue(carRaceCollision(n: 2) == 4) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 3) == 9) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 4) == 16) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 8) == 64) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 10) == 100) // cannot find 'carRaceCollision' in scope

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    for i in 0..<n {
        for j in 0..<n {
            if i != j {
                if i < j {
                    if i < j - 1 {
                        collisions += 1
                    }
                } else {
                    if i > j + 1 {
                        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 {
                if i < j {
                    if i < j - 1 {
                        collisions += 1
                    }
                } else {
                    if i > j + 1 {
                        collisions += 1
                    }
                }
            }
        }
    }
    return collisions
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    var leftCars = 0
    var rightCars = 0
    for i in 1...n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    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
    var leftCars = 0
    var rightCars = 0
    for i in 1...n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    return collisions
}
```

 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    var leftCars = 0
    var rightCars = 0
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    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
    var leftCars = 0
    var rightCars = 0
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    return collisions
}
```

 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    var leftCars = 0
    var rightCars = 0
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    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
    var leftCars = 0
    var rightCars = 0
    for i in 0..<n {
        if i % 2 == 0 {
            leftCars += 1
        } else {
            rightCars += 1
        }
        if leftCars > rightCars {
            collisions += leftCars - rightCars
            leftCars = rightCars
        }
    }
    return collisions
}
```

 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    var collisions = 0
    for i in 0..<n {
        for j in 0..<n {
            if i != j && abs(i - j) == 1 {
                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 && abs(i - j) == 1 {
                collisions += 1
            }
        }
    }
    return collisions
}
```

 // XCTAssertTrue failed

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

 // 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 {
    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 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 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 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 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 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 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 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 pairsSumToZero(l: [Int]) -> Bool {
    var dict = [Int: Int]()
    for i in l {
        if dict[i] != nil {
            return true
        } else {
            dict[-i] = 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 dict = [Int: Int]()
    for i in l {
        if dict[i] != nil {
            return true
        } else {
            dict[-i] = i
        }
    }
    return 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
}
```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 x = x
    var base = base
    var result = ""
    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 x = x
    var base = base
    var result = ""
    while x > 0 {
        result = "\(x % base)" + result
        x /= base
    }
    return result
}
```

var base = base // variable 'base' was never mutated; consider changing to 'let' constant

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

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

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

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

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

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

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

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

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

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

return (a * h) / 2 // cannot convert return expression of type 'Int' to return type 'Double'

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

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

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

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

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

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

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

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

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

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

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

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

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

func fib4(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 2
    } else if n == 3 {
        return 0
    } else {
        var fib4 = [0, 0, 2, 0]
        for i in 4...n {
            fib4[i % 4] = fib4[(i - 1) % 4] + fib4[(i - 2) % 4] + fib4[(i - 3) % 4] + fib4[(i - 4) % 4]
        }
        return fib4[n % 4]
    }
}
```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 {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 2
    } else if n == 3 {
        return 0
    } else {
        var fib4 = [0, 0, 2, 0]
        for i in 4...n {
            fib4[i % 4] = fib4[(i - 1) % 4] + fib4[(i - 2) % 4] + fib4[(i - 3) % 4] + fib4[(i - 4) % 4]
        }
        return fib4[n % 4]
    }
}
```

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

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

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

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

func fib4(n: Int) -> Int {
    if n == 0 || n == 1 || n == 2 {
        return 0
    } else if n == 3 {
        return 2
    } else {
        var fib4 = [0, 0, 2, 0]
        for i in 4...n {
            fib4[i % 4] = fib4[(i - 1) % 4] + fib4[(i - 2) % 4] + fib4[(i - 3) % 4] + fib4[(i - 4) % 4]
        }
        return fib4[n % 4]
    }
}
```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 {
    if n == 0 || n == 1 || n == 2 {
        return 0
    } else if n == 3 {
        return 2
    } else {
        var fib4 = [0, 0, 2, 0]
        for i in 4...n {
            fib4[i % 4] = fib4[(i - 1) % 4] + fib4[(i - 2) % 4] + fib4[(i - 3) % 4] + fib4[(i - 4) % 4]
        }
        return fib4[n % 4]
    }
}
```

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

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

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

var sorted = l.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

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

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

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

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

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

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

var sorted = l.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

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

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```
if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```

if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let textArray = text.map { String($0) }
    var left = 0
    var right = textArray.count - 1
    while left < right {
        if textArray[left] != textArray[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let textArray = text.map { String($0) }
    var left = 0
    var right = textArray.count - 1
    while left < right {
        if textArray[left] != textArray[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```

func isPalindrome(text: String) -> Bool {
    var text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    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 {
    var text = text.lowercased()
    var left = 0
    var right = text.count - 1
    while left < right {
        if text[left] != text[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```

var text = text.lowercased() // variable 'text' was never mutated; consider changing to 'let' constant
if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if text[left] != text[right] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let reversedText = String(text.reversed())
    return text == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let textArray = Array(text)
    var left = 0
    var right = textArray.count - 1
    while left < right {
        if textArray[left] != textArray[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let text = text.lowercased()
    let textArray = Array(text)
    var left = 0
    var right = textArray.count - 1
    while left < right {
        if textArray[left] != textArray[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}
```

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

return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'

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

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

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

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

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

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

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

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

// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) ==
return pow(n: n, p: p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n: n, p: p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n: n, p: p) % p // extraneous argument labels 'n:p:' in call

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

return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'

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

return pow(n: n, p: p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n: n, p: p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n: n, p: p) % p // extraneous argument labels 'n:p:' in call

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

return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'

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

p = (p * p) % p // cannot assign to value: 'p' is a 'let' constant

func modp(n: Int, p: Int) -> Int {
    return pow(n: n, p: p) % p
}

func powp(n: Int, p: Int) -> Int {
    var result = 1
    var base = n
    var exponent = p
    while exponent > 0 {
        if exponent % 2 == 1 {
            result = (result * base) % p
        }
        base = (base * base) % p
        exponent /= 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 {
    return pow(n: n, p: p) % p
}

// Return 2^n modulo p (be aware of numerics).
// powp(n: 3, p: 5) == 3
// powp(n: 1101, p: 101) == 9
// powp(n: 0, p: 101) == 1
// powp(n: 3, p: 11) == 8
// powp(n: 100, p: 101) == 1
func powp(n: Int, p: Int) -> Int {
    var result = 1
    var base = n
    var exponent = p
    while exponent > 0 {
        if exponent % 2 == 1 {
            result = (result * base) % p
        }
        base = (base * base) % p
        exponent /= 2
    }
    return result
}
```
return pow(n: n, p: p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'
return pow(n: n, p: p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n: n, p: p) % p // extraneous argument labels 'n:p:' in call

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

 // Fatal error: Double value cannot be converted to Int because the result would be greater than Int.max

func modp(n: Int, p: Int) -> Int {
    return pow(n: n, p: p) % p
}

func pow(n: Int, p: Int) -> Int {
    var result = 1
    var base = n
    var power = p
    while power > 0 {
        if power % 2 == 1 {
            result = (result * base) % p
        }
        base = (base * base) % p
        power /= 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 {
    return pow(n: n, p: p) % p
}

// Return 2^n modulo p (be aware of numerics).
// pow(n: 3, p: 5) == 3
// pow(n: 1101, p: 101) == 2
// pow(n: 0, p: 101) == 1
// pow(n: 3, p: 11) == 8
// pow(n: 100, p: 101) == 1
func pow(n: Int, p: Int) -> Int {
    var result = 1
    var base = n
    var power = p
    while power > 0 {
        if power % 2 == 1 {
            result = (result * base) % p
        }
        base = (base * base) % p
        power /= 2
    }
    return result
}
```

 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    while n < 0 {
        n += p
    }
    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 {
    var n = n
    var p = p
    while n < 0 {
        n += p
    }
    return n % p
}
```

var p = p // variable 'p' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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) {
            continue
        }
        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) {
            continue
        }
        result.append(char)
    }
    return result
}
```

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

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

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

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) {
            continue
        }
        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) {
            continue
        }
        result.append(char)
    }
    return result
}
```

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 = 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 belowThreshold(l: [Int], t: Int) -> Bool {
    for num in l {
        if num >= 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 num in l {
        if num >= t {
            return false
        }
    }
    return true
}
```

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

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

func belowThreshold(l: [Int], t: Int) -> Bool {
    return l.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
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
    for num in l {
        if num >= 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 num in l {
        if num >= t {
            return false
        }
    }
    return true
}
```

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 num in l {
        if num >= 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 num in l {
        if num >= t {
            return false
        }
    }
    return true
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}
```

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

var s0 = s0.sorted() // variable 's0' was never mutated; consider changing to 'let' constant
var s1 = s1.sorted() // variable 's1' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```

func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    // Check if the sets have the same elements.
    return set0 == set1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    // Check if the sets have the same elements.
    return set0 == set1
}
```

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

var s0 = s0.sorted() // variable 's0' was never mutated; consider changing to 'let' constant
var s1 = s1.sorted() // variable 's1' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

var s0 = s0.sorted() // variable 's0' was never mutated; consider changing to 'let' constant
var s1 = s1.sorted() // variable 's1' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

var s0 = s0.sorted() // variable 's0' was never mutated; consider changing to 'let' constant
var s1 = s1.sorted() // variable 's1' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

var s0 = s0.sorted() // variable 's0' was never mutated; consider changing to 'let' constant
var s1 = s1.sorted() // variable 's1' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```

func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    // Convert the strings to sets of characters.
    let set0 = Set(s0)
    let set1 = Set(s1)
    
    // Check if the sets have the same elements.
    return set0 == set1
}
```

func sameChars(s0: String, s1: String) -> Bool {
    let s0Chars = Array(s0)
    let s1Chars = Array(s1)
    if s0Chars.count != s1Chars.count {
        return false
    }
    var s0CharsSet = Set<Character>()
    for char in s0Chars {
        s0CharsSet.insert(char)
    }
    for char in s1Chars {
        if !s0CharsSet.contains(char) {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0Chars = Array(s0)
    let s1Chars = Array(s1)
    if s0Chars.count != s1Chars.count {
        return false
    }
    var s0CharsSet = Set<Character>()
    for char in s0Chars {
        s0CharsSet.insert(char)
    }
    for char in s1Chars {
        if !s0CharsSet.contains(char) {
            return false
        }
    }
    return true
}
```

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "<" {
            count += 1
        } else if bracket == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "<" {
            count += 1
        } else if char == ">" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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
            }
            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
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

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

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

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

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

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

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

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

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

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

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

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

 // XCTAssertTrue failed

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

var set1 = Set(l1) // variable 'set1' was never mutated; consider changing to 'let' constant
var set2 = Set(l2) // variable 'set2' was never mutated; consider changing to 'let' constant

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var divisor = 2
    
    while n > 1 {
        while n % divisor == 0 {
            largestFactor = divisor
            n /= divisor
        }
        divisor += 1
    }
    
    return largestFactor
}
```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 largestFactor = 1
    var divisor = 2
    
    while n > 1 {
        while n % divisor == 0 {
            largestFactor = divisor
            n /= divisor
        }
        divisor += 1
    }
    
    return largestFactor
}
```

n /= divisor // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```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 largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```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 largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 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 factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 1
        }
    }
    return n
}
```

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 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 factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 1
        }
    }
    return n
}
```

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var number = n
    var divisor = 2
    while number > 1 {
        while number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        }
        divisor += 1
    }
    return largestFactor
}
```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 largestFactor = 1
    var number = n
    var divisor = 2
    while number > 1 {
        while number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        }
        divisor += 1
    }
    return largestFactor
}
```

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

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```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 largestFactor = 1
    var number = n
    var divisor = 2
    
    while number > 1 {
        if number % divisor == 0 {
            largestFactor = divisor
            number /= divisor
        } else {
            divisor += 1
        }
    }
    
    return largestFactor
}
```

func largestPrimeFactor(n: Int) -> Int {
    var largestFactor = 1
    var num = n
    var i = 2
    while i * i <= num {
        if num % i == 0 {
            largestFactor = i
            num /= i
        } else {
            i += 1
        }
    }
    if num > 1 {
        largestFactor = num
    }
    return largestFactor
}
```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 largestFactor = 1
    var num = n
    var i = 2
    while i * i <= num {
        if num % i == 0 {
            largestFactor = i
            num /= i
        } else {
            i += 1
        }
    }
    if num > 1 {
        largestFactor = num
    }
    return largestFactor
}
```

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 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 factor = 2
    while factor * factor <= n {
        if n % factor == 0 {
            n /= factor
        } else {
            factor += 1
        }
    }
    return n
}
```

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 {
    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 {
    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 {
    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 {
    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 {
    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 {
    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 {
    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 {
    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 {
    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 correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "(" {
            count += 1
        } else if char == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "(" {
            count += 1
        } else if char == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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
            }
            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
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for bracket in brackets {
        if bracket == "(" {
            count += 1
        } else if bracket == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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
            }
            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
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "(" {
            count += 1
        } else if char == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var count = 0
    for char in brackets {
        if char == "(" {
            count += 1
        } else if char == ")" {
            count -= 1
        }
        if count < 0 {
            return false
        }
    }
    return count == 0
}
```

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

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

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

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

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

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

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

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

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

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

func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            let nextFibfib = fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3]
            fibfibValues.append(nextFibfib)
        }
        return fibfibValues[n]
    }
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            let nextFibfib = fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3]
            fibfibValues.append(nextFibfib)
        }
        return fibfibValues[n]
    }
}
```

func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```

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

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

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

func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```

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

func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        var fibfibValues = [0, 0, 1]
        for i in 3...n {
            fibfibValues.append(fibfibValues[i-1] + fibfibValues[i-2] + fibfibValues[i-3])
        }
        return fibfibValues[n]
    }
}
```

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

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

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

 // XCTAssertTrue failed

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

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

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

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

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

// Test cases
print(circularShift(x: 12, shift: 1)) // "21"
print(circularShift(x: 12, shift: 2)) // "12"
print(circularShift(x: 12, shift: 3)) // "21"
print(circularShift(x: 12, shift: 4)) // "12"
print(circularShift(x: 12, shift: 5)) // "21"
print(circularShift(x: 12, shift: 6)) // "12"
print(circularShift(x: 12, shift: 7)) // "21"
print(circularShift(x: 12, shift: 8)) // "12"
print(circularShift(x: 12, shift: 9)) // "21"
print(circularShift(x: 12, shift: 10)) // "12"
print(circularShift(x: 12, shift: 11)) // "21"
print(circularShift(x: 12, shift: 12)) // "12"
print(circularShift(x: 12, shift: 13)) // "21"
print(circularShift(x: 12, shift: 14)) // "12"
print(circularShift(x: 12, shift: 15)) // "21"
print(circularShift(x: 12, shift: 16)) // "12"
print(circularShift(x: 12, shift: 17)) // "21"
print(circularShift(x: 12, shift: 18)) // "12"
print(circularShift(x: 12, shift: 19)) // "21"
print(circularShift(x: 12, shift: 20)) // "12"
print(circularShift(x: 12, shift: 21)) // "21"
print(circularShift(x: 12, shift: 22)) // "12"
print(circularShift(x: 12, shift: 23)) // "21"
print(circularShift(x: 12, shift: 24)) // "12"
print(circularShift(x: 12, shift: 25)) // "21"
print(circularShift(x: 12, shift: 26)) // "12"
print(circularShift(x: 12, shift: 27)) // "21"
print(circularShift(x: 12, shift: 28)) // "12"
print(circularShift(x: 12, shift: 29)) // "21"
print(circularShift(x: 12, shift: 30)) // "12"
print(circularShift(x: 12, shift: 31)) // "21"
print(circularShift(x: 12, shift: 32)) // "12"
print(circularShift(x: 12, shift: 33)) // "21"
print(circularShift(x: 12, shift: 34)) // "12"
print(circularShift(x: 12, shift: 35)) // "21"
print(circularShift(x: 12, shift: 36)) // "12"
print(circularShift(x: 12, shift: 37)) // "21"
print(circularShift(x: 12, shift: 38)) // "12"
print(circularShift(x: 12, shift: 39)) // "21"
print(circularShift(x: 12, shift: 40)) // "12"
print(circularShift(x: 12, shift: 41)) // "21"
print(circularShift(x: 12, shift: 42)) // "12"
print(circularShift(x: 12, shift: 43)) // "21"
print(circularShift(x: 12, shift: 44)) // "12"
print(circularShift(x: 12, shift: 45)) // "21"
print(circularShift(x: 12, shift: 46))
return String(shiftedDigits) // no exact matches in call to initializer

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

return String(shiftedDigits) // no exact matches in call to initializer

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

// Test cases
print(circularShift(x: 12, shift: 1)) // "21"
print(circularShift(x: 12, shift: 2)) // "12"
print(circularShift(x: 12, shift: 3)) // "21"
print(circularShift(x: 12, shift: 4)) // "21"
print(circularShift(x: 12, shift: 5)) // "21"
print(circularShift(x: 12, shift: 6)) // "21"
print(circularShift(x: 12, shift: 7)) // "21"
print(circularShift(x: 12, shift: 8)) // "21"
print(circularShift(x: 12, shift: 9)) // "21"
print(circularShift(x: 12, shift: 10)) // "21"
print(circularShift(x: 12, shift: 11)) // "21"
print(circularShift(x: 12, shift: 12)) // "21"
print(circularShift(x: 12, shift: 13)) // "21"
print(circularShift(x: 12, shift: 14)) // "21"
print(circularShift(x: 12, shift: 15)) // "21"
print(circularShift(x: 12, shift: 16)) // "21"
print(circularShift(x: 12, shift: 17)) // "21"
print(circularShift(x: 12, shift: 18)) // "21"
print(circularShift(x: 12, shift: 19)) // "21"
print(circularShift(x: 12, shift: 20)) // "21"
print(circularShift(x: 12, shift: 21)) // "21"
print(circularShift(x: 12, shift: 22)) // "21"
print(circularShift(x: 12, shift: 23)) // "21"
print(circularShift(x: 12, shift: 24)) // "21"
print(circularShift(x: 12, shift: 25)) // "21"
print(circularShift(x: 12, shift: 26)) // "21"
print(circularShift(x: 12, shift: 27)) // "21"
print(circularShift(x: 12, shift: 28)) // "21"
print(circularShift(x: 12, shift: 29)) // "21"
print(circularShift(x: 12, shift: 30)) // "21"
print(circularShift(x: 12, shift: 31)) // "21"
print(circularShift(x: 12, shift: 32)) // "21"
print(circularShift(x: 12, shift: 33)) // "21"
print(circularShift(x: 12, shift: 34)) // "21"
print(circularShift(x: 12, shift: 35)) // "21"
print(circularShift(x: 12, shift: 36)) // "21"
print(circularShift(x: 12, shift: 37)) // "21"
print(circularShift(x: 12, shift: 38)) // "21"
print(circularShift(x: 12, shift: 39)) // "21"
print(circularShift(x: 12, shift: 40)) // "21"
print(circularShift(x: 12, shift: 41)) // "21"
print(circularShift(x: 12, shift: 42)) // "21"
print(circularShift(x: 12, shift: 43)) // "21"
print(circularShift(x: 12, shift: 44)) // "21"
print(circularShift(x: 12, shift: 45)) // "21"
print(circularShift(x: 12, shift: 46)) // "21"
print
return String(shiftedDigits) // no exact matches in call to initializer

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

// Test cases
print(circularShift(x: 12, shift: 1)) // "21"
print(circularShift(x: 12, shift: 2)) // "12"
print(circularShift(x: 12, shift: 3)) // "21"
print(circularShift(x: 12, shift: 4)) // "21"
print(circularShift(x: 12, shift: 5)) // "21"
print(circularShift(x: 12, shift: 6)) // "21"
print(circularShift(x: 12, shift: 7)) // "21"
print(circularShift(x: 12, shift: 8)) // "21"
print(circularShift(x: 12, shift: 9)) // "21"
print(circularShift(x: 12, shift: 10)) // "21"
print(circularShift(x: 12, shift: 11)) // "21"
print(circularShift(x: 12, shift: 12)) // "21"
print(circularShift(x: 12, shift: 13)) // "21"
print(circularShift(x: 12, shift: 14)) // "21"
print(circularShift(x: 12, shift: 15)) // "21"
print(circularShift(x: 12, shift: 16)) // "21"
print(circularShift(x: 12, shift: 17)) // "21"
print(circularShift(x: 12, shift: 18)) // "21"
print(circularShift(x: 12, shift: 19)) // "21"
print(circularShift(x: 12, shift: 20)) // "21"
print(circularShift(x: 12, shift: 21)) // "21"
print(circularShift(x: 12, shift: 22)) // "21"
print(circularShift(x: 12, shift: 23)) // "21"
print(circularShift(x: 12, shift: 24)) // "21"
print(circularShift(x: 12, shift: 25)) // "21"
print(circularShift(x: 12, shift: 26)) // "21"
print(circularShift(x: 12, shift: 27)) // "21"
print(circularShift(x: 12, shift: 28)) // "21"
print(circularShift(x: 12, shift: 29)) // "21"
print(circularShift(x: 12, shift: 30)) // "21"
print(circularShift(x: 12, shift: 31)) // "21"
print(circularShift(x: 12, shift: 32)) // "21"
print(circularShift(x: 12, shift: 33)) // "21"
print(circularShift(x: 12, shift: 34)) // "21"
print(circularShift(x: 12, shift: 35)) // "21"
print(circularShift(x: 12, shift: 36)) // "21"
print(circularShift(x: 12, shift: 37)) // "21"
print(circularShift(x: 12, shift: 38)) // "21"
print(circularShift(x: 12, shift: 39)) // "21"
print(circularShift(x: 12, shift: 40)) // "21"
print(circularShift(x: 12, shift: 41)) // "21"
print(circularShift(x: 12, shift: 42)) // "21"
print(circularShift(x: 12, shift: 43)) // "21"
print(circularShift(x: 12, shift: 44)) // "21"
print(circularShift(x: 12, shift: 45)) // "21"
print(circularShift(x: 12, shift: 46)) //
let shiftedDigits = digits.suffix(effectiveShift).concatenate(with: digits.prefix(numDigits - effectiveShift)) // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'concatenate'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let numDigits = digits.count
    let effectiveShift = shift % numDigits
    let shiftedDigits = digits.suffix(effectiveShift) + digits.prefix(numDigits - effectiveShift)
    return String(shiftedDigits)
}

func checkCircularShift() {
    assert(circularShift(x: 12, shift: 1) == "21")
    assert(circularShift(x: 12, shift: 2) == "12")
    assert(circularShift(x: 12345, shift: 3) == "45123")
    assert(circularShift(x: 12345, shift: 5) == "12345")
    assert(circularShift(x: 12345, shift: 6) == "54321")
    print("All checks passed.")
}
```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 numDigits = digits.count
    let effectiveShift = shift % numDigits
    let shiftedDigits = digits.suffix(effectiveShift) + digits.prefix(numDigits - effectiveShift)
    return String(shiftedDigits)
}

// Check function to verify the correctness of the circularShift function
func checkCircularShift() {
    assert(circularShift(x: 12, shift: 1) == "21")
    assert(circularShift(x: 12, shift: 2) == "12")
    assert(circularShift(x: 12345, shift: 3) == "45123")
    assert(circularShift(x: 12345, shift: 5) == "12345")
    assert(circularShift(x: 12345, shift: 6) == "54321")
    print("All checks passed.")
}

// Run the check function to verify the solution
checkCircularShift()
```

return String(shiftedDigits) // no exact matches in call to initializer

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

let shiftedDigits = digits.suffix(effectiveShift).concatenate(with: digits.prefix(numDigits - effectiveShift)) // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'concatenate'

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

return String(shiftedDigits) // no exact matches in call to initializer

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

// Test cases
print(circularShift(x: 12, shift: 1)) // "21"
print(circularShift(x: 12, shift: 2)) // "12"
print(circularShift(x: 12, shift: 3)) // "21"
print(circularShift(x: 12, shift: 4)) // "21"
print(circularShift(x: 12, shift: 5)) // "21"
print(circularShift(x: 12, shift: 6)) // "21"
print(circularShift(x: 12, shift: 7)) // "21"
print(circularShift(x: 12, shift: 8)) // "21"
print(circularShift(x: 12, shift: 9)) // "21"
print(circularShift(x: 12, shift: 10)) // "21"
print(circularShift(x: 12, shift: 11)) // "21"
print(circularShift(x: 12, shift: 12)) // "21"
print(circularShift(x: 12, shift: 13)) // "21"
print(circularShift(x: 12, shift: 14)) // "21"
print(circularShift(x: 12, shift: 15)) // "21"
print(circularShift(x: 12, shift: 16)) // "21"
print(circularShift(x: 12, shift: 17)) // "21"
print(circularShift(x: 12, shift: 18)) // "21"
print(circularShift(x: 12, shift: 19)) // "21"
print(circularShift(x: 12, shift: 20)) // "21"
print(circularShift(x: 12, shift: 21)) // "21"
print(circularShift(x: 12, shift: 22)) // "21"
print(circularShift(x: 12, shift: 23)) // "21"
print(circularShift(x: 12, shift: 24)) // "21"
print(circularShift(x: 12, shift: 25)) // "21"
print(circularShift(x: 12, shift: 26)) // "21"
print(circularShift(x: 12, shift: 27)) // "21"
print(circularShift(x: 12, shift: 28)) // "21"
print(circularShift(x: 12, shift: 29)) // "21"
print(circularShift(x: 12, shift: 30)) // "21"
print(circularShift(x: 12, shift: 31)) // "21"
print(circularShift(x: 12, shift: 32)) // "21"
print(circularShift(x: 12, shift: 33)) // "21"
print(circularShift(x: 12, shift: 34)) // "21"
print(circularShift(x: 12, shift: 35)) // "21"
print(circularShift(x: 12, shift: 36)) // "21"
print(circularShift(x: 12, shift: 37)) // "21"
print(circularShift(x: 12, shift: 38)) // "21"
print(circularShift(x: 12, shift: 39)) // "21"
print(circularShift(x: 12, shift: 40)) // "21"
print(circularShift(x: 12, shift: 41)) // "21"
print(circularShift(x: 12, shift: 42)) // "21"
print(circularShift(x: 12, shift: 43)) // "21"
print(circularShift(x: 12, shift: 44)) // "21"
print(circularShift(x: 12, shift: 45)) // "21"
print(circularShift(x: 12, shift: 46)) // "21
return String(shiftedDigits) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let numDigits = digits.count
    let effectiveShift = shift % numDigits
    let shiftedDigits = digits.suffix(effectiveShift).concatenate(with: digits.prefix(numDigits - effectiveShift))
    return String(shiftedDigits)
}

func checkCircularShift() {
    assert(circularShift(x: 12, shift: 1) == "21")
    assert(circularShift(x: 12, shift: 2) == "12")
    assert(circularShift(x: 12345, shift: 2) == "34512")
    assert(circularShift(x: 12345, shift: 5) == "12345")
    assert(circularShift(x: 12345, shift: 6) == "45123")
    print("All tests passed.")
}
```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 numDigits = digits.count
    let effectiveShift = shift % numDigits
    let shiftedDigits = digits.suffix(effectiveShift).concatenate(with: digits.prefix(numDigits - effectiveShift))
    return String(shiftedDigits)
}

// Check function to verify the correctness of the circularShift function
func checkCircularShift() {
    assert(circularShift(x: 12, shift: 1) == "21")
    assert(circularShift(x: 12, shift: 2) == "12")
    assert(circularShift(x: 12345, shift: 2) == "34512")
    assert(circularShift(x: 12345, shift: 5) == "12345")
    assert(circularShift(x: 12345, shift: 6) == "45123")
    print("All tests passed.")
}

// Run the check function to verify the solution
checkCircularShift()
```

let shiftedDigits = digits.suffix(effectiveShift).concatenate(with: digits.prefix(numDigits - effectiveShift)) // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'concatenate'

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

return String(digits.reversed()) // no exact matches in call to initializer
return String(shiftedDigits) // no exact matches in call to initializer

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
}
```
sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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

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

sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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

sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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
}
```
sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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

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

sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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

return s.reduce(0) { $1.isUppercase ? $0 + Int($1.asciiValue!.value) : $0 } // cannot convert return expression of type '(Int, _) -> Int' to return type 'Int'
return s.reduce(0) { $1.isUppercase ? $0 + Int($1.asciiValue!.value) : $0 } // missing argument label 'into:' in call

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

sum += Int(char.asciiValue!)! // missing argument label 'exactly:' in call

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

return s.reduce(0) { $1.isUppercase ? $0 + Int($1.asciiValue!.value) : $0 } // cannot convert return expression of type '(Int, _) -> Int' to return type 'Int'
return s.reduce(0) { $1.isUppercase ? $0 + Int($1.asciiValue!.value) : $0 } // missing argument label 'into:' in call

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = n
    let mangoFruits = totalFruits - apples - oranges
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = n
    let mangoFruits = totalFruits - apples - oranges
    return mangoFruits
}
```
 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    return mangoFruits
}
```
 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    return mangoFruits
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    return mangoFruits
}
```
 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    return mangoFruits
}
```

 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    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 parts = s.components(separatedBy: " ")
    let apples = Int(parts[0]) ?? 0
    let oranges = Int(parts[2]) ?? 0
    let totalFruits = apples + oranges
    let mangoFruits = n - totalFruits
    return mangoFruits
}
```

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

func search(lst: [Int]) -> Int {
    var frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= 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 frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= 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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= num {
            return num
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= 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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            return num
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= 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 frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, frequency) in frequencyMap {
        if frequency >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            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 frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            return num
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            return num
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            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 frequencyMap: [Int: Int] = [:]
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    let sortedKeys = frequencyMap.keys.sorted(by: >)
    for key in sortedKeys {
        if frequencyMap[key]! >= 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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    let sortedKeys = frequencyMap.keys.sorted(by: >)
    for key in sortedKeys {
        if frequencyMap[key]! >= key {
            return key
        }
    }
    return -1
}
```

func search(lst: [Int]) -> Int {
    var frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            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 frequencyMap = [Int: Int]()
    for num in lst {
        frequencyMap[num, default: 0] += 1
    }
    for (num, freq) in frequencyMap {
        if num <= freq {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

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

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

func strangeSortList(lst: [Int]) -> [Int] {
    var sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        if sortedList.count % 2 == 0 {
            result.append(sortedList.removeFirst())
            result.append(sortedList.removeLast())
        } else {
            result.append(sortedList.removeFirst())
            result.append(sortedList.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 sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        if sortedList.count % 2 == 0 {
            result.append(sortedList.removeFirst())
            result.append(sortedList.removeLast())
        } else {
            result.append(sortedList.removeFirst())
            result.append(sortedList.removeLast())
        }
    }
    return result
}
```

 // Fatal error: Can't remove last element from an empty collection

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

func strangeSortList(lst: [Int]) -> [Int] {
    var result: [Int] = []
    var sortedList = lst.sorted()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.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 sortedList = lst.sorted()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.removeLast())
        }
    }
    return result
}
```

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

func strangeSortList(lst: [Int]) -> [Int] {
    var sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.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 sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.removeLast())
        }
    }
    return result
}
```

func strangeSortList(lst: [Int]) -> [Int] {
    var sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.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 sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.removeLast())
        }
    }
    return result
}
```

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

func strangeSortList(lst: [Int]) -> [Int] {
    var sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.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 sortedList = lst.sorted()
    var result = [Int]()
    while !sortedList.isEmpty {
        result.append(sortedList.removeFirst())
        if !sortedList.isEmpty {
            result.append(sortedList.removeLast())
        }
    }
    return result
}
```

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

let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

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

let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

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

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```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 {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```

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

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

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

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```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 {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```

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

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```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 {
    // Check if the sides form a valid triangle
    if a + b <= c || a + c <= b || b + c <= a {
        return -1.0
    }
    
    // Calculate the semi-perimeter
    let s = (a + b + c) / 2.0
    
    // Calculate the area using Heron's formula
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    
    // Return the area rounded to 2 decimal points
    return round(area * 100) / 100
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q == q.reversed()
    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 == q.reversed()
    return isBalanced && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    return q == q.reversed() && 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, +)
    return q == q.reversed() && sum <= w
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q == q.reversed()
    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 == q.reversed()
    return isBalanced && sum <= w
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```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 changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```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 changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```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 changes = 0
    
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```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 changes = 0
    while left < right {
        if arr[left] != arr[right] {
            changes += 1
        }
        left += 1
        right -= 1
    }
    return changes
}
```

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

 // XCTAssertTrue failed

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

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

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

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

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

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

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

i = 2 // cannot assign to value: 'i' is a 'let' constant

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

func isMultiplyPrime(a: Int) -> Bool {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        return true
    } else {
        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 {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        return true
    } else {
        return false
    }
}
```

 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var result = false
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        result = true
    }
    return result
}
```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 result = false
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        result = true
    }
    return result
}
```

 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 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 count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    return count == 3
}
```

 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    if a < 100 {
        var primeFactors = [Int]()
        var number = a
        for i in 2...number {
            if number % i == 0 {
                primeFactors.append(i)
                number /= i
            }
        }
        if primeFactors.count == 3 {
            return true
        } else {
            return false
        }
    } else {
        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 {
    if a < 100 {
        var primeFactors = [Int]()
        var number = a
        for i in 2...number {
            if number % i == 0 {
                primeFactors.append(i)
                number /= i
            }
        }
        if primeFactors.count == 3 {
            return true
        } else {
            return false
        }
    } else {
        return false
    }
}
```

 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var result = false
    for i in 2...a {
        if a % i == 0 {
            result = true
            break
        }
    }
    return result
}
```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 result = false
    for i in 2...a {
        if a % i == 0 {
            result = true
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 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 count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    return count == 3
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var isPrime = true
    for i in 2...a/2 {
        if a % i == 0 {
            isPrime = false
            break
        }
    }
    if isPrime {
        return true
    } else {
        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 {
    var isPrime = true
    for i in 2...a/2 {
        if a % i == 0 {
            isPrime = false
            break
        }
    }
    if isPrime {
        return true
    } else {
        return false
    }
}
```

 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        return true
    } else {
        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 {
    var count = 0
    for i in 2...a {
        if a % i == 0 {
            count += 1
        }
    }
    if count == 3 {
        return true
    } else {
        return false
    }
}
```

 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```

 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```

 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    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 {
    if n == 1 {
        return x == 1
    }
    var power = 1
    while power < x {
        power *= n
        if power == x {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == -1 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000 || a == 1331 || a == 1728 || a == 2197 || a == 2744 || a == 3375 || a == 4096 || a == 4913 || a == 5832 || a == 6859 || a == 8000 || a == 8748 || a == 9261 || a == 10368 || a == 117649 || a == 134217728 || a == 15625 || a == 1771561 || a == 19683 || a == 21970000 || a == 243890625 || a == 279936 || a == 303700049 || a == 33967 || a == 3645000000 || a == 390625 || a == 419904000000 || a == 45000000000000 || a == 482680966308416 || a == 50625 || a == 531441 || a == 562500000000000 || a == 59049 || a == 62748517984 || a == 6561 || a == 707788800000000000 || a == 759375 || a == 81000000000000000000 || a == 8201600000000000000000 || a == 846240000000000000000000 || a == 86093440000000000000000000 || a == 874800000000000000000000000 || a == 88473600000000000000000000000 || a == 9077561000000000000000000000000 || a == 926100000000000000000000000000000 || a == 9411956250000000000000000000000000 || a == 964800000000000000000000000000000000 || a == 9881600000000000000000000000000000000 || a == 101250000000000000000000000000000000000 || a == 10368000000000000000000000000000000000000 || a == 106288000000000000000000000000000000000000 || a == 1089000000000000000000000000000000000000000 || a == 11176000000000000
XCTAssertTrue(iscube(a: 1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 2) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: -1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 64) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 180) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1000) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 0) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1729) == false) // cannot find 'iscube' in scope

func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```
 // XCTAssertTrue failed

```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == -1 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000 || a == 1331 || a == 1728 || a == 2197 || a == 2744 || a == 3375 || a == 4096 || a == 4913 || a == 5832 || a == 6859 || a == 8000 || a == 8748 || a == 9261 || a == 10384 || a == 117649 || a == 134217728 || a == 15625 || a == 17576 || a == 19683 || a == 21952 || a == 24389 || a == 27440 || a == 29791 || a == 32768 || a == 35840 || a == 38416 || a == 41006 || a == 43740 || a == 46656 || a == 496729 || a == 524288 || a == 552960 || a == 583200 || a == 614656 || a == 640000 || a == 669856 || a == 70368744177647 || 729000000000000 || 757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575
XCTAssertTrue(iscube(a: 1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 2) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: -1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 64) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 180) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1000) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 0) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1729) == false) // cannot find 'iscube' in scope

func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```

 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    let cubeRoot = Int(pow(Double(a), 1.0/3.0))
    return cubeRoot * cubeRoot * cubeRoot == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    let cubeRoot = Int(pow(Double(a), 1.0/3.0))
    return cubeRoot * cubeRoot * cubeRoot == a
}
```

 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    if a == 0 {
        return true
    }
    if a < 0 {
        return false
    }
    let cubeRoot = Int(pow(Double(a), 1.0/3.0))
    return cubeRoot * cubeRoot * cubeRoot == 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 {
    if a == 0 {
        return true
    }
    if a < 0 {
        return false
    }
    let cubeRoot = Int(pow(Double(a), 1.0/3.0))
    return cubeRoot * cubeRoot * cubeRoot == a
}
```
 // XCTAssertTrue failed

```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000 || a == 1331 || a == 1728 || a == 2197 || a == 2744 || a == 3375 || a == 4096 || a == 4913 || a == 5832 || a == 6859 || a == 8000 || a == 9261 || a == 10648 || a == 12167 || a == 13824 || a == 15625 || a == 17576 || a == 19683 || a == 21952 || a == 24389 || a == 27000 || a == 29791 || a == 32768 || a == 35937 || a == 39304 || a == 42875 || a == 46656 || a == 50653 || a == 54872 || a == 59049 || a == 63776 || a == 68127 || a == 72900 || a == 777600 || a == 830400 || a == 885600 || a == 941196 || a == 1000000 || a == 1064800 || a == 1125000 || a == 1188137 || a == 1250000 || a == 1323425 || a == 1399680 || a == 1476225 || a == 1562500 || a == 1651506 || a == 1749600 || a == 1847561 || a == 1944000 || a == 2048000 || a == 2157384 || a == 2268816 || a == 2383281 || a == 2500000 || a == 2621440 || a == 2759792 || a == 2903040 || a == 3051757 || a == 3200000 || a == 3375000 || a == 3538940 || a == 3750000 || a == 3932160 || a == 4100625 || a == 4287500 || a == 4488000 || a == 4665600 || a == 4842500 || a == 5038845 || a == 5242880 || a == 5468750 || a == 5668704 || a == 5898240 || a == 6144000 || a == 6377344 || a == 6635520 || a == 6912000 || a == 7174400 || a == 7464900 || a == 7749137 || a == 8000000 || a == 8294400 || a == 8599632 || a == 8957952 || a == 9375000 || a == 9807675 || a == 10240000 || a == 10649019 || a == 11065770 || a == 11520000 || a == 12000000 || a == 12500000 || a == 13107200 ||
XCTAssertTrue(iscube(a: 1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 2) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: -1) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 64) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 180) == false) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1000) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 0) == true) // cannot find 'iscube' in scope
XCTAssertTrue(iscube(a: 1729) == false) // cannot find 'iscube' in scope

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) * 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)) * 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 {
    let cubeRoot = Int(pow(Double(a), 1.0 / 3.0))
    return cubeRoot * cubeRoot * cubeRoot == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    let cubeRoot = Int(pow(Double(a), 1.0 / 3.0))
    return cubeRoot * cubeRoot * cubeRoot == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    return a == 0 || a == 1 || a == 8 || a == 27 || a == 64 || a == 125 || a == 216 || a == 343 || a == 512 || a == 729 || a == 1000
}
```
 // XCTAssertTrue failed

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 {
    let primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.filter { primes.contains($0) }.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 primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.filter { primes.contains($0) }.count
}
```
return num.filter { primes.contains($0) }.count // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

func hexKey(num: String) -> Int {
    let hexDigits = Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
    var count = 0
    for digit in num {
        if hexDigits.contains(String(digit)) {
            if digit == "2" || digit == "3" || digit == "5" || digit == "7" || digit == "B" || digit == "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 {
    let hexDigits = Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
    var count = 0
    for digit in num {
        if hexDigits.contains(String(digit)) {
            if digit == "2" || digit == "3" || digit == "5" || digit == "7" || digit == "B" || digit == "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
}
```

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 primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.filter { primes.contains($0) }.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 primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.filter { primes.contains($0) }.count
}
```
return num.filter { primes.contains($0) }.count // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

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

func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    var primeDigits = "2357BD"
    var count = 0
    for digit in num {
        if primeDigits.contains(digit) {
            count += 1
        }
    }
    return count
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    var primeDigits = "2357BD"
    var count = 0
    for digit in num {
        if primeDigits.contains(digit) {
            count += 1
        }
    }
    return count
}
```
let hexDigits = "0123456789ABCDEF" // initialization of immutable value 'hexDigits' was never used; consider replacing with assignment to '_' or removing it
var primeDigits = "2357BD" // variable 'primeDigits' was never mutated; consider changing to 'let' constant

func hexKey(num: String) -> Int {
    let primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.reduce(0) { $0 + primes.contains(String($1)) ? 1 : 0 }
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    let primes = Set(["2", "3", "5", "7", "B", "D"])
    return num.reduce(0) { $0 + primes.contains(String($1)) ? 1 : 0 }
}
```
return num.reduce(0) { $0 + primes.contains(String($1)) ? 1 : 0 } // cannot convert value of type 'Bool' to expected argument type 'Int'
return num.reduce(0) { $0 + primes.contains(String($1)) ? 1 : 0 } // type 'Int' cannot be used as a boolean; test for '!= 0' instead

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var charSet = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if charSet.contains(char) {
                return false
            }
            charSet.insert(char)
            if charSet.contains(s[i + 1]) && charSet.contains(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 {
    guard s.count >= 3 else { return false }
    var charSet = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if charSet.contains(char) {
                return false
            }
            charSet.insert(char)
            if charSet.contains(s[i + 1]) && charSet.contains(s[i + 2]) {
                return false
            }
        }
    }
    return true
}
```
if charSet.contains(s[i + 1]) && charSet.contains(s[i + 2]) { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if charSet.contains(s[i + 1]) && charSet.contains(s[i + 2]) { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var charSet = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if charSet.contains(char) {
                return false
            }
            charSet.insert(char)
            if charSet.count == 3 {
                charSet.remove(s[i + 1])
                charSet.remove(s[i + 2])
            }
        }
    }
    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 charSet = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if charSet.contains(char) {
                return false
            }
            charSet.insert(char)
            if charSet.count == 3 {
                charSet.remove(s[i + 1])
                charSet.remove(s[i + 2])
            }
        }
    }
    return true
}
```
charSet.remove(s[i + 1]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
charSet.remove(s[i + 2]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var seen = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if seen.contains(char) || seen.contains(s[i + 1]) || seen.contains(s[i + 2]) {
                return false
            }
            seen.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 seen = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            if seen.contains(char) || seen.contains(s[i + 1]) || seen.contains(s[i + 2]) {
                return false
            }
            seen.insert(char)
        }
    }
    return true
}
```

if seen.contains(char) || seen.contains(s[i + 1]) || seen.contains(s[i + 2]) { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if seen.contains(char) || seen.contains(s[i + 1]) || seen.contains(s[i + 2]) { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    for i in 0..<s.count - 2 {
        let char1 = s[s.index(s.startIndex, offsetBy: i)]
        let char2 = s[s.index(s.startIndex, offsetBy: i + 1)]
        let char3 = s[s.index(s.startIndex, offsetBy: i + 2)]
        if char1 == char2 || char2 == char3 || char1 == char3 {
            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 }
    for i in 0..<s.count - 2 {
        let char1 = s[s.index(s.startIndex, offsetBy: i)]
        let char2 = s[s.index(s.startIndex, offsetBy: i + 1)]
        let char3 = s[s.index(s.startIndex, offsetBy: i + 2)]
        if char1 == char2 || char2 == char3 || char1 == char3 {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    for i in 0..<s.count - 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 {
    guard s.count >= 3 else { return false }
    for i in 0..<s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
    }
    return true
}
```

if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var seen = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            let nextChar = s[s.index(s.startIndex, offsetBy: i + 1)]
            let nextNextChar = s[s.index(s.startIndex, offsetBy: i + 2)]
            if seen.contains(char) || seen.contains(nextChar) || seen.contains(nextNextChar) {
                return false
            }
            seen.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 seen = Set<Character>()
    for (i, char) in s.enumerated() {
        if i + 2 < s.count {
            let nextChar = s[s.index(s.startIndex, offsetBy: i + 1)]
            let nextNextChar = s[s.index(s.startIndex, offsetBy: i + 2)]
            if seen.contains(char) || seen.contains(nextChar) || seen.contains(nextNextChar) {
                return false
            }
            seen.insert(char)
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var 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 }
    var 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
}
```
var chars = Array(s) // variable 'chars' was never mutated; consider changing to 'let' constant

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var 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 }
    var 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
}
```

var chars = Array(s) // variable 'chars' was never mutated; consider changing to 'let' constant

func isHappy(s: String) -> Bool {
    var 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 {
    var 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
}
```
var chars = Array(s) // variable 'chars' was never mutated; consider changing to 'let' constant
 // Fatal error: Range requires lowerBound <= upperBound

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var 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 }
    var 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
}
```
var chars = Array(s) // variable 'chars' was never mutated; consider changing to 'let' constant

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

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

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

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

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

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

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

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

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

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

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

func primeLength(string: String) -> Bool {
    let length = string.count
    if length <= 1 {
        return false
    }
    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
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```

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

return 2 * (9 * pow(10, n - 2)) // cannot convert return expression of type 'Decimal' to return type 'Int'

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

return 2 * (9 * pow(10, n - 2)) // cannot convert return expression of type 'Decimal' to return type 'Int'

func startsOneEnds(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 18
    } else {
        return 10 * startsOneEnds(n: n - 1) + 10 * startsOneEnds(n: n - 2)
    }
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 18
    } else {
        return 10 * startsOneEnds(n: n - 1) + 10 * startsOneEnds(n: n - 2)
    }
}
```

 // XCTAssertTrue failed

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

return 2 * (9 * pow(10, n - 2)) // cannot convert return expression of type 'Decimal' to return type 'Int'

func startsOneEnds(n: Int) -> Int {
    // If n is 1, there are 2 numbers that start or end with 1 (1 and 10)
    if n == 1 {
        return 2
    }
    
    // If n is 2, there are 3 numbers that start or end with 1 (1, 10, 11)
    if n == 2 {
        return 3
    }
    
    // If n is greater than 2, there are 2 * (10^(n-1) - 1) numbers that start or end with 1
    return 2 * (Int(pow(Double(10), Double(n - 1))) - 1)
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    // If n is 1, there are 2 numbers that start or end with 1 (1 and 10)
    if n == 1 {
        return 2
    }
    
    // If n is 2, there are 3 numbers that start or end with 1 (1, 10, 11)
    if n == 2 {
        return 3
    }
    
    // If n is greater than 2, there are 2 * (10^(n-1) - 1) numbers that start or end with 1
    return 2 * (Int(pow(Double(10), Double(n - 1))) - 1)
}
```

 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    // Base case: If n is 1, there are 2 numbers that start or end with 1 (1 and 10).
    if n == 1 {
        return 2
    }
    
    // Recursive case: Calculate the count of numbers for n-1 digits.
    let countForNMinusOne = startsOneEnds(n: n - 1)
    
    // The count of numbers that start or end with 1 for n digits is the sum of:
    // 1. The count of numbers that start with 1 and have (n-1) digits.
    // 2. The count of numbers that end with 1 and have (n-1) digits.
    // 3. The count of numbers that have (n-1) digits and start or end with 1.
    return countForNMinusOne * 2 + countForNMinusOne
}
```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 {
    // Base case: If n is 1, there are 2 numbers that start or end with 1 (1 and 10).
    if n == 1 {
        return 2
    }
    
    // Recursive case: Calculate the count of numbers for n-1 digits.
    let countForNMinusOne = startsOneEnds(n: n - 1)
    
    // The count of numbers that start or end with 1 for n digits is the sum of:
    // 1. The count of numbers that start with 1 and have (n-1) digits.
    // 2. The count of numbers that end with 1 and have (n-1) digits.
    // 3. The count of numbers that have (n-1) digits and start or end with 1.
    return countForNMinusOne * 2 + countForNMinusOne
}
```

 // XCTAssertTrue failed

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

return Int(total + start + end) // no exact matches in call to initializer

func startsOneEnds(n: Int) -> Int {
    // Base case: If n is 1, there are 2 numbers that start or end with 1 (1 and 10).
    if n == 1 {
        return 2
    }
    
    // Recursive case: Calculate the count for n-1 digits and multiply by 2.
    // This is because for each number of n-1 digits, there are two possibilities:
    // 1. The number starts with 1 and has n-1 digits.
    // 2. The number ends with 1 and has n-1 digits.
    return 2 * startsOneEnds(n: n - 1)
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    // Base case: If n is 1, there are 2 numbers that start or end with 1 (1 and 10).
    if n == 1 {
        return 2
    }
    
    // Recursive case: Calculate the count for n-1 digits and multiply by 2.
    // This is because for each number of n-1 digits, there are two possibilities:
    // 1. The number starts with 1 and has n-1 digits.
    // 2. The number ends with 1 and has n-1 digits.
    return 2 * startsOneEnds(n: n - 1)
}
```

 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    if n == 1 {
        return 1
    }
    let count = startsOneEnds(n: n - 1) * 2
    if n % 2 == 0 {
        return 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 {
    if n == 1 {
        return 1
    }
    let count = startsOneEnds(n: n - 1) * 2
    if n % 2 == 0 {
        return count - 1
    }
    return count
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func solve(N: Int) -> String {
    let sum = String(N).reduce(0, { $0 + $1.wholeNumberValue! })
    return sum.toBinaryString()
}
```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 {
    let sum = String(N).reduce(0, { $0 + $1.wholeNumberValue! })
    return sum.toBinaryString()
}
```

return sum.toBinaryString() // value of type 'Int' has no member 'toBinaryString'

func solve(N: Int) -> String {
    let sum = String(N).reduce(0) { $0 + Int(String($1))! }
    return String(sum, 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 {
    let sum = String(N).reduce(0) { $0 + Int(String($1))! }
    return String(sum, radix: 2)
}
```

func solve(N: Int) -> String {
    let sum = String(N).reduce(0) { $0 + Int(String($1))! }
    return String(sum, 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 {
    let sum = String(N).reduce(0) { $0 + Int(String($1))! }
    return String(sum, radix: 2)
}
```

func solve(N: Int) -> String {
    let sum = String(N.description).map { Int(String($0))! }.reduce(0, +)
    return String(sum, 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 {
    let sum = String(N.description).map { Int(String($0))! }.reduce(0, +)
    return String(sum, radix: 2)
}
```

func solve(N: Int) -> String {
    let sum = String(N).map { Int(String($0))! }.reduce(0, +)
    return String(sum, 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 {
    let sum = String(N).map { Int(String($0))! }.reduce(0, +)
    return String(sum, radix: 2)
}
```

func solve(N: Int) -> String {
    let digits = String(N).map { Int(String($0))! }
    let sum = digits.reduce(0, +)
    return String(sum, 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 {
    let digits = String(N).map { Int(String($0))! }
    let sum = digits.reduce(0, +)
    return String(sum, radix: 2)
}
```

func solve(N: Int) -> String {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```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 {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```

let sum = N.map { String($0) }.reduce("", +) // value of type 'Int' has no member 'map'

func solve(N: Int) -> String {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```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 {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```

let sum = N.map { String($0) }.reduce("", +) // value of type 'Int' has no member 'map'

func solve(N: Int) -> String {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```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 {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```

let sum = N.map { String($0) }.reduce("", +) // value of type 'Int' has no member 'map'

func solve(N: Int) -> String {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```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 {
    let sum = N.map { String($0) }.reduce("", +)
    return sum.map { String($0) }.reduce("", +)
}
```
let sum = N.map { String($0) }.reduce("", +) // value of type 'Int' has no member 'map'

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let chars = Array(word)
        let sortedChars = chars.sorted()
        return String(sortedChars)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let chars = Array(word)
        let sortedChars = chars.sorted()
        return String(sortedChars)
    }
    return orderedWords.joined(separator: " ")
}
```

var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let chars = Array(word)
        let sortedChars = chars.sorted()
        return String(sortedChars)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let chars = Array(word)
        let sortedChars = chars.sorted()
        return String(sortedChars)
    }
    return orderedWords.joined(separator: " ")
}
```

var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let sortedCharacters = Array(word).sorted()
        return String(sortedCharacters)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let sortedCharacters = Array(word).sorted()
        return String(sortedCharacters)
    }
    return orderedWords.joined(separator: " ")
}
```

var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let sortedCharacters = Array(word).sorted()
        return String(sortedCharacters)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let sortedCharacters = Array(word).sorted()
        return String(sortedCharacters)
    }
    return orderedWords.joined(separator: " ")
}
```
var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let characters = Array(word)
        let sortedCharacters = characters.sorted { $0 < $1 }
        return String(sortedCharacters)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let characters = Array(word)
        let sortedCharacters = characters.sorted { $0 < $1 }
        return String(sortedCharacters)
    }
    return orderedWords.joined(separator: " ")
}
```

var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespacesAndNewlines)
}
```

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var orderedWords = words.map { word in
        let characters = Array(word)
        let sortedCharacters = characters.sorted(by: <)
        return String(sortedCharacters)
    }
    return orderedWords.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: " ")
    var orderedWords = words.map { word in
        let characters = Array(word)
        let sortedCharacters = characters.sorted(by: <)
        return String(sortedCharacters)
    }
    return orderedWords.joined(separator: " ")
}
```

var orderedWords = words.map { word in // variable 'orderedWords' was never mutated; consider changing to 'let' constant

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```

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

for (index, row) in lst.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let column = row.firstIndex(of: x) {
            result.append((index, column))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let column = row.firstIndex(of: x) {
            result.append((index, column))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (columnIndex, value) in row.enumerated() {
            if value == x {
                result.append((index, column - 1))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (columnIndex, value) in row.enumerated() {
            if value == x {
                result.append((index, column - 1))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```
result.append((index, column - 1)) // expansion of macro 'column()' requires leading '#'
result.append((index, column - 1)) // binary operator '-' cannot be applied to operands of type '() -> Int' and 'Int'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result
}
```
for (index, row) in lst.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```
for (index, row) in lst.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result.sorted { $0.0 < $1.0 }
}
```
for (index, row) in lst.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let index = row.firstIndex(of: x) {
            result.append((index, index))
        }
    }
    return result
}
```
for (index, row) in lst.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
 // 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.sorted { (first, second) -> Bool in
        if first.0 == second.0 {
            return first.1 > second.1
        } else {
            return first.0 < second.0
        }
    }
}
```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.sorted { (first, second) -> Bool in
        if first.0 == second.0 {
            return first.1 > second.1
        } else {
            return first.0 < second.0
        }
    }
}
```

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

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let foundIndex = row.firstIndex(of: x) {
            result.append((index, foundIndex))
        }
    }
    return result.sorted { $0.0 < $1.0 && $0.1 > $1.1 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if let foundIndex = row.firstIndex(of: x) {
            result.append((index, foundIndex))
        }
    }
    return result.sorted { $0.0 < $1.0 && $0.1 > $1.1 }
}
```

 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```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] {
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty { return [] }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty { return [] }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

func sortArray(array: [Int]) -> [Int] {
    let sortedArray = array.sorted(by: { $0 < $1 })
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        return sortedArray.reversed()
    } else {
        return sortedArray
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    let sortedArray = array.sorted(by: { $0 < $1 })
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        return sortedArray.reversed()
    } else {
        return sortedArray
    }
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.sort { $0 > $1 }
    } else {
        sortedArray.sort { $0 < $1 }
    }
    return sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.sort { $0 > $1 }
    } else {
        sortedArray.sort { $0 < $1 }
    }
    return sortedArray
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.sort { $0 > $1 }
    } else {
        sortedArray.sort { $0 < $1 }
    }
    return sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.sort { $0 > $1 }
    } else {
        sortedArray.sort { $0 < $1 }
    }
    return sortedArray
}
```

 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    if array.count == 1 {
        return array
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

func sortArray(array: [Int]) -> [Int] {
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```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] {
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    if array.isEmpty {
        return []
    }
    let sum = array.first! + array.last!
    if sum % 2 == 0 {
        return array.sorted(by: >)
    } else {
        return array.sorted(by: <)
    }
}
```

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        let shiftedIndex = alphabet.index(index, offsetBy: 2 * 2)
        encryptedString.append(alphabet[shiftedIndex])
    }
    
    return encryptedString
}

func decrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var decryptedString = ""
    
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        let shiftedIndex = alphabet.index(index, offsetBy: -2 * 2)
        decryptedString.append(alphabet[shiftedIndex])
    }
    
    return decryptedString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        let shiftedIndex = alphabet.index(index, offsetBy: 2 * 2)
        encryptedString.append(alphabet[shiftedIndex])
    }
    
    return encryptedString
}

// 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 {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var decryptedString = ""
    
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        let shiftedIndex = alphabet.index(index, offsetBy: -2 * 2)
        decryptedString.append(alphabet[shiftedIndex])
    }
    
    return decryptedString
}
```

let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char)) // cannot convert value of type 'Character' to expected argument type 'String.Index'
let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char)) // cannot convert value of type 'Character' to expected argument type 'String.Index'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let rotatedAlphabet = alphabet + alphabet + alphabet
    let encryptedString = s.map { rotatedAlphabet.index(of: String($0))! }.map { rotatedAlphabet[$0] }.joined()
    return encryptedString
}
```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 rotatedAlphabet = alphabet + alphabet + alphabet
    let encryptedString = s.map { rotatedAlphabet.index(of: String($0))! }.map { rotatedAlphabet[$0] }.joined()
    return encryptedString
}
```

let encryptedString = s.map { rotatedAlphabet.index(of: String($0))! }.map { rotatedAlphabet[$0] }.joined() // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
let encryptedString = s.map { rotatedAlphabet.index(of: String($0))! }.map { rotatedAlphabet[$0] }.joined() // cannot convert value of type 'Character' to closure result type 'String'

func encrypt(s: String) -> String {
    var encryptedString = ""
    for char in s {
        let asciiValue = Int(char.asciiValue ?? 0)
        if asciiValue >= 65 && asciiValue <= 90 { // uppercase letters
            let shiftedAscii = (asciiValue - 65 + 2 * 2) % 26 + 65
            encryptedString.append(Character(UnicodeScalar(shiftedAscii)!))
        } else if asciiValue >= 97 && asciiValue <= 122 { // lowercase letters
            let shiftedAscii = (asciiValue - 97 + 2 * 2) % 26 + 97
            encryptedString.append(Character(UnicodeScalar(shiftedAscii)!))
        } else {
            encryptedString.append(char)
        }
    }
    return encryptedString
}
```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 encryptedString = ""
    for char in s {
        let asciiValue = Int(char.asciiValue ?? 0)
        if asciiValue >= 65 && asciiValue <= 90 { // uppercase letters
            let shiftedAscii = (asciiValue - 65 + 2 * 2) % 26 + 65
            encryptedString.append(Character(UnicodeScalar(shiftedAscii)!))
        } else if asciiValue >= 97 && asciiValue <= 122 { // lowercase letters
            let shiftedAscii = (asciiValue - 97 + 2 * 2) % 26 + 97
            encryptedString.append(Character(UnicodeScalar(shiftedAscii)!))
        } else {
            encryptedString.append(char)
        }
    }
    return encryptedString
}
```

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let rotatedAlphabet = alphabet + alphabet + alphabet
    let encryptedString = s.map { rotatedAlphabet.index(of: $0) ?? 0 }.map { rotatedAlphabet[$0] }.joined()
    return encryptedString
}
```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 rotatedAlphabet = alphabet + alphabet + alphabet
    let encryptedString = s.map { rotatedAlphabet.index(of: $0) ?? 0 }.map { rotatedAlphabet[$0] }.joined()
    return encryptedString
}
```

let encryptedString = s.map { rotatedAlphabet.index(of: $0) ?? 0 }.map { rotatedAlphabet[$0] }.joined() // subscript 'subscript(_:)' requires that 'String.Index' conform to 'RangeExpression'
let encryptedString = s.map { rotatedAlphabet.index(of: $0) ?? 0 }.map { rotatedAlphabet[$0] }.joined() // cannot convert value of type 'Int' to expected argument type 'String.Index'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let shiftedAlphabet = alphabet + alphabet + alphabet
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(shiftedAlphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```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 shiftedAlphabet = alphabet + alphabet + alphabet
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(shiftedAlphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```

if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2 * alphabet.count) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    for char in s {
        let charIndex = alphabet.index(alphabet.startIndex, offsetBy: alphabet.index(of: char)!)
        let shiftedIndex = (charIndex + 2 * alphabet.index(of: "a")!) % alphabet.count
        encryptedString.append(alphabet[shiftedIndex])
    }
    return encryptedString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    for char in s {
        let charIndex = alphabet.index(alphabet.startIndex, offsetBy: alphabet.index(of: char)!)
        let shiftedIndex = (charIndex + 2 * alphabet.index(of: "a")!) % alphabet.count
        encryptedString.append(alphabet[shiftedIndex])
    }
    return encryptedString
}
```

let charIndex = alphabet.index(alphabet.startIndex, offsetBy: alphabet.index(of: char)!) // instance method 'index(_:offsetBy:)' requires that 'String.Index' conform to 'BinaryInteger'
let shiftedIndex = (charIndex + 2 * alphabet.index(of: "a")!) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```

if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2 * alphabet.count) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let rotatedAlphabet = alphabet + alphabet + alphabet
    var result = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            result.append(rotatedAlphabet[newIndex])
        } else {
            result.append(char)
        }
    }
    
    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 {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let rotatedAlphabet = alphabet + alphabet + alphabet
    var result = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            result.append(rotatedAlphabet[newIndex])
        } else {
            result.append(char)
        }
    }
    
    return result
}
```
if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2 * alphabet.count) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    return encryptedString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    return encryptedString
}
```

if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2 * alphabet.count) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encryptedString = ""
    
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2 * alphabet.count) % alphabet.count
            encryptedString.append(alphabet[newIndex])
        } else {
            encryptedString.append(char)
        }
    }
    
    return encryptedString
}
```

if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2 * alphabet.count) % alphabet.count // cannot convert value of type 'String.Index' to expected argument type 'Int'

func nextSmallest(lst: [Int]) -> Int? {
    // 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? {
    // Your code here
}
```

} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // 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? {
    // Your code here
}
```

} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    guard !lst.isEmpty else { return nil }
    let sortedList = lst.sorted()
    let secondSmallest = sortedList[1]
    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.isEmpty else { return nil }
    let sortedList = lst.sorted()
    let secondSmallest = sortedList[1]
    return secondSmallest
}
```

 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    let firstElement = sortedList[0]
    let secondElement = sortedList[1]
    if firstElement == secondElement {
        return nil
    }
    return secondElement
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    let firstElement = sortedList[0]
    let secondElement = sortedList[1]
    if firstElement == secondElement {
        return nil
    }
    return secondElement
}
```

var sortedList = lst.sorted() // variable 'sortedList' was never mutated; consider changing to 'let' constant

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    var secondSmallest: Int?
    for i in 1..<sortedList.count {
        if sortedList[i] != sortedList[i - 1] {
            secondSmallest = sortedList[i]
            break
        }
    }
    return secondSmallest
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    var secondSmallest: Int?
    for i in 1..<sortedList.count {
        if sortedList[i] != sortedList[i - 1] {
            secondSmallest = sortedList[i]
            break
        }
    }
    return secondSmallest
}
```
var sortedList = lst.sorted() // variable 'sortedList' was never mutated; consider changing to 'let' constant

func nextSmallest(lst: [Int]) -> Int? {
    guard !lst.isEmpty else { return nil }
    let sorted = lst.sorted()
    let secondSmallest = sorted[1]
    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.isEmpty else { return nil }
    let sorted = lst.sorted()
    let secondSmallest = sorted[1]
    return secondSmallest
}
```

 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    var secondSmallest: Int?
    for i in 1..<sortedList.count {
        if sortedList[i] != sortedList[i - 1] {
            secondSmallest = sortedList[i]
            break
        }
    }
    return secondSmallest
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    var sortedList = lst.sorted()
    var secondSmallest: Int?
    for i in 1..<sortedList.count {
        if sortedList[i] != sortedList[i - 1] {
            secondSmallest = sortedList[i]
            break
        }
    }
    return secondSmallest
}
```
var sortedList = lst.sorted() // variable 'sortedList' was never mutated; consider changing to 'let' constant

func nextSmallest(lst: [Int]) -> Int? {
    let sortedList = lst.sorted()
    if sortedList.count < 2 {
        return nil
    } else {
        return sortedList[1]
    }
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    let sortedList = lst.sorted()
    if sortedList.count < 2 {
        return nil
    } else {
        return sortedList[1]
    }
}
```

 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    let sortedList = lst.sorted()
    return sortedList[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    let sortedList = lst.sorted()
    return sortedList[1]
}
```

 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    let sorted = lst.sorted()
    return sorted[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    let sorted = lst.sorted()
    return sorted[1]
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    
    return boredomCount
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespaces).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".?!")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".?!")
    var boredomCount = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```

 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let sentences = S.components(separatedBy: ".!?")
    var count = 0
    for sentence in sentences {
        if sentence.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if any number is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        // Return false if any number is not an integer
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if any number is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        // Return false if any number is not an integer
        return false
    }
}
```
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    let sum = x + y
    let difference = abs(x - y)
    let product = x * y
    let quotient = x / y
    let remainder = x % y
    let power = x ** y
    let squareRoot = x.squareRoot()
    let cubeRoot = x.cubeRoot()
    let absoluteValue = x.absoluteValue()
    let sign = x.sign()
    let floor = x.floor()
    let ceil = x.ceil()
    let round = x.round()
    let trunc = x.trunc()
    let isEven = x.isEven()
    let isOdd = x.isOdd()
    let isPositive = x.isPositive()
    let isNegative = x.isNegative()
    let isZero = x.isZero()
    let isOne = x.isOne()
    let isTwo = x.isTwo()
    let isThree = x.isThree()
    let isFour = x.isFour()
    let isFive = x.isFive()
    let isSix = x.isSix()
    let isSeven = x.isSeven()
    let isEight = x.isEight()
    let isNine = x.isNine()
    let isTen = x.isTen()
    let isEleven = x.isEleven()
    let isTwelve = x.isTwelve()
    let isThirteen = x.isThirteen()
    let isFourteen = x.isFourteen()
    let isFifteen = x.isFifteen()
    let isSixteen = x.isSixteen()
    let isSeventeen = x.isSeventeen()
    let isEighteen = x.isEighteen()
    let isNineteen = x.isNineteen()
    let isTwenty = x.isTwenty()
    let isTwentyOne = x.isTwentyOne()
    let isTwentyTwo = x.isTwentyTwo()
    let isTwentyThree = x.isTwentyThree()
    let isTwentyFour = x.isTwentyFour()
    let isTwentyFive = x.isTwentyFive()
    let isTwentySix = x.isTwentySix()
    let isTwentySeven = x.isTwentySeven()
    let isTwentyEight = x.isTwentyEight()
    let isTwentyNine = x.isTwentyNine()
    let isThirty = x.isThirty()
    let isThirtyOne = x.isThirtyOne()
    let isThirtyTwo = x.isThirtyTwo()
    let isThirtyThree = x.isThirtyThree()
    let isThirtyFour = x.isThirtyFour()
    let isThirtyFive = x.isThirtyFive()
    let isThirtySix = x.isThirtySix()
    let isThirtySeven = x.isThirtySeven()
    let isThirtyEight = x.isThirtyEight()
    let isThirtyNine = x.isThirtyNine()
    let isForty = x.isForty()
    let isFortyOne = x.isFortyOne()
    let isFortyTwo = x.isFortyTwo()
    let isFortyThree = x.isFortyThree()
    let isFortyFour = x.isFortyFour()
    let isFortyFive = x.isFortyFive()
    let isFortySix = x.isFortySix()
    let isFortySeven = x.isFortySeven()
    let isFortyEight = x.isFortyEight()
    let isFortyNine = x.isFortyNine()
    let isFifty = x.isFifty()
    let isFiftyOne = x.isFiftyOne()
    let isFiftyTwo = x.isFiftyTwo()
    let isFiftyThree = x.isFiftyThree()
    let isFiftyFour = x.isFiftyFour()
    let isFiftyFive = x.isFiftyFive()
    let isFiftySix = x.isFiftySix()
    let isFiftySeven = x.isFiftySeven()
    let isFiftyEight = x.isFiftyEight()
    let isFiftyNine = x.isFiftyNine()
    let isSixty = x.isSixty()
    let isSixtyOne = x.isSixtyOne()
    let isSixtyTwo = x.isSixtyTwo()
    let isSixtyThree = x.isSixtyThree()
    let isSixtyFour = x.isSixtyFour()
    let isSixtyFive = x.isSixtyFive()
    let isSixtySix = x.isSixtySix()
    let isSixtySeven = x.isSixtySeven()
    let isSixtyEight = x.isSixtyEight()
    let isSixtyNine = x.isSixtyNine()
    let isSeventy = x.isSeventy()
    let isSeventyOne = x.isSeventyOne()
    let isSeventyTwo = x.isSeventyTwo()
    let isSeventyThree = x.isSeventyThree()
    let isSeventyFour = x.is
XCTAssertTrue(anyInt(x: 2, y: 3, z: 1) == true) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 2.5, y: 2, z: 3) == false) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 1.5, y: 5, z: 3.5) == false) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 2, y: 6, z: 2) == false) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 4, y: 2, z: 2) == true) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 2.2, y: 2.2, z: 2.2) == false) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: -4, y: 6, z: 2) == true) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 2, y: 1, z: 1) == true) // cannot find 'anyInt' in scope
XCTAssertTrue(anyInt(x: 3, y: 4, z: 7) == true) // cannot find 'anyInt' in scope

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if one of the numbers is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if one of the numbers is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```

if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```

if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    }
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    }
    return false
}
```

if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if one of the numbers is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // Check if all numbers are integers
    if x.isInteger && y.isInteger && z.isInteger {
        // Check if one of the numbers is equal to the sum of the other two
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x == y + z) || (y == x + z) || (z == x + y)
}
```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) || (y == x + z) || (z == x + y)
}
```

 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```

if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    let sum = x + y
    let diff = abs(x - y)
    let product = x * y
    let quotient = x / y
    return sum == z || diff == z || product == z || quotient == z
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    let sum = x + y
    let diff = abs(x - y)
    let product = x * y
    let quotient = x / y
    return sum == z || diff == z || product == z || quotient == z
}
```

 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    if x.isInteger && y.isInteger && z.isInteger {
        return x == y + z || y == x + z || z == x + y
    } else {
        return false
    }
}
```
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'
if x.isInteger && y.isInteger && z.isInteger { // value of type 'Double' has no member 'isInteger'

```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 = "aeiouAEIOU"
    let alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let index = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: char)!)
            let nextIndex = alphabet.index(alphabet.startIndex, offsetBy: alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(alphabet.index(al
XCTAssertTrue(encode(message: "TEST") == "tgst") // cannot find 'encode' in scope
XCTAssertTrue(encode(message: "Mudasir") == "mWDCSKR") // cannot find 'encode' in scope
XCTAssertTrue(encode(message: "YES") == "ygs") // cannot find 'encode' in scope
XCTAssertTrue(encode(message: "This is a message") == "tHKS KS C MGSSCGG") // cannot find 'encode' in scope
XCTAssertTrue(encode(message: "I DoNt KnOw WhAt tO WrItE") == "k dQnT kNqW wHcT Tq wRkTg") // cannot find 'encode' in scope

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isUppercase {
            let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!)
            encodedMessage.append(newChar)
        } else {
            let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!)
            encodedMessage.append(newChar)
        }
    }
    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.isUppercase {
            let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!)
            encodedMessage.append(newChar)
        } else {
            let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!)
            encodedMessage.append(newChar)
        }
    }
    return encodedMessage
}
```

let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!) // cannot force unwrap value of non-optional type 'UnicodeScalar' (aka 'Unicode.Scalar')
let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!) // cannot force unwrap value of non-optional type 'UnicodeScalar' (aka 'Unicode.Scalar')

func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: char)!)
            let nextVowel = vowels[vowelIndex + 2..<vowelIndex + 3]
            encodedMessage.append(nextVowel)
        } else {
            let lowerChar = char.isLowercase ? char.uppercased() : char.lowercased()
            encodedMessage.append(lowerChar)
        }
    }
    
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: char)!)
            let nextVowel = vowels[vowelIndex + 2..<vowelIndex + 3]
            encodedMessage.append(nextVowel)
        } else {
            let lowerChar = char.isLowercase ? char.uppercased() : char.lowercased()
            encodedMessage.append(lowerChar)
        }
    }
    
    return encodedMessage
}
```
let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: char)!) // instance method 'index(_:offsetBy:)' requires that 'String.Index' conform to 'BinaryInteger'

func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let index = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: String(char))! + 2)
            encodedMessage.append(String(vowels[index]))
        } else {
            encodedMessage.append(char.isLowercase ? char.uppercased() : char.lowercased())
        }
    }
    
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let index = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: String(char))! + 2)
            encodedMessage.append(String(vowels[index]))
        } else {
            encodedMessage.append(char.isLowercase ? char.uppercased() : char.lowercased())
        }
    }
    
    return encodedMessage
}
```
let index = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: String(char))! + 2) // cannot convert value of type 'String.Index' to expected argument type 'Int'
let index = vowels.index(vowels.startIndex, offsetBy: vowels.firstIndex(of: String(char))! + 2) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in message {
        if vowels.contains(String(char)) {
            let index = vowels.firstIndex(of: String(char))!
            let newIndex = (index + 2) % vowels.count
            result.append(vowels[newIndex])
        } else {
            let newChar = String(char).uppercased()
            result.append(newChar)
        }
    }
    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 {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in message {
        if vowels.contains(String(char)) {
            let index = vowels.firstIndex(of: String(char))!
            let newIndex = (index + 2) % vowels.count
            result.append(vowels[newIndex])
        } else {
            let newChar = String(char).uppercased()
            result.append(newChar)
        }
    }
    return result
}
```

let index = vowels.firstIndex(of: String(char))! // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let asciiValue = char.unicodeScalars.first!.value
            if asciiValue >= 65 && asciiValue <= 90 {
                // Upper case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 90 {
                    newAsciiValue -= 26
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? ""))
            } else if asciiValue >= 97 && asciiValue <= 122 {
                // Lower case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 122 {
                    newAsciiValue -= 26
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? ""))
            } else {
                // Non-letter character
                encodedMessage.append(char)
            }
        } else {
            // Non-letter character
            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 asciiValue = char.unicodeScalars.first!.value
            if asciiValue >= 65 && asciiValue <= 90 {
                // Upper case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 90 {
                    newAsciiValue -= 26
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? ""))
            } else if asciiValue >= 97 && asciiValue <= 122 {
                // Lower case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 122 {
                    newAsciiValue -= 26
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? ""))
            } else {
                // Non-letter character
                encodedMessage.append(char)
            }
        } else {
            // Non-letter character
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}
```

newAsciiValue -= 26 // left side of mutating operator isn't mutable: 'newAsciiValue' is a 'let' constant
encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? "")) // cannot convert value of type 'String' to expected argument type 'UnicodeScalar' (aka 'Unicode.Scalar')
newAsciiValue -= 26 // left side of mutating operator isn't mutable: 'newAsciiValue' is a 'let' constant
encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? "")) // cannot convert value of type 'String' to expected argument type 'UnicodeScalar' (aka 'Unicode.Scalar')

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let asciiValue = Int(char.asciiValue!)
            if asciiValue >= 65 && asciiValue <= 90 {
                // Upper case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 90 {
                    newAsciiValue = 65 + (newAsciiValue - 90) - 1
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue)!))
            } else {
                // Lower case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 122 {
                    newAsciiValue = 97 + (newAsciiValue - 122) - 1
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue)!))
            }
        } 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 asciiValue = Int(char.asciiValue!)
            if asciiValue >= 65 && asciiValue <= 90 {
                // Upper case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 90 {
                    newAsciiValue = 65 + (newAsciiValue - 90) - 1
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue)!))
            } else {
                // Lower case letter
                let newAsciiValue = asciiValue + 1
                if newAsciiValue > 122 {
                    newAsciiValue = 97 + (newAsciiValue - 122) - 1
                }
                encodedMessage.append(Character(UnicodeScalar(newAsciiValue)!))
            }
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}
```

newAsciiValue = 65 + (newAsciiValue - 90) - 1 // cannot assign to value: 'newAsciiValue' is a 'let' constant
newAsciiValue = 97 + (newAsciiValue - 122) - 1 // cannot assign to value: 'newAsciiValue' is a 'let' constant

func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.index(of: String(char))!)
            let nextVowelIndex = vowels.index(vowelIndex, offsetBy: 2)
            let nextVowel = vowels[nextVowelIndex]
            encodedMessage.append(nextVowel)
        } else {
            let isUpperCase = char.isUppercase
            let lowerChar = char.lowercased()
            let shiftedChar = String(lowerChar.asciiValue! + 1)
            let newChar = isUpperCase ? shiftedChar.uppercased() : shiftedChar
            encodedMessage.append(newChar)
        }
    }
    
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    let vowels = "aeiouAEIOU"
    var encodedMessage = ""
    
    for char in message {
        if vowels.contains(String(char)) {
            let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.index(of: String(char))!)
            let nextVowelIndex = vowels.index(vowelIndex, offsetBy: 2)
            let nextVowel = vowels[nextVowelIndex]
            encodedMessage.append(nextVowel)
        } else {
            let isUpperCase = char.isUppercase
            let lowerChar = char.lowercased()
            let shiftedChar = String(lowerChar.asciiValue! + 1)
            let newChar = isUpperCase ? shiftedChar.uppercased() : shiftedChar
            encodedMessage.append(newChar)
        }
    }
    
    return encodedMessage
}
```

let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.index(of: String(char))!) // instance method 'index(_:offsetBy:)' requires that 'String.Index' conform to 'BinaryInteger'
let vowelIndex = vowels.index(vowels.startIndex, offsetBy: vowels.index(of: String(char))!) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
let shiftedChar = String(lowerChar.asciiValue! + 1) // value of type 'String' has no member 'asciiValue'

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLowercase {
            let asciiValue = Int(char.asciiValue!)
            let newAsciiValue = asciiValue == 122 ? 97 : asciiValue + 1
            encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? char))
        } else {
            let asciiValue = Int(char.asciiValue!)
            let newAsciiValue = asciiValue == 90 ? 65 : asciiValue + 1
            encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? 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.isLowercase {
            let asciiValue = Int(char.asciiValue!)
            let newAsciiValue = asciiValue == 122 ? 97 : asciiValue + 1
            encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? char))
        } else {
            let asciiValue = Int(char.asciiValue!)
            let newAsciiValue = asciiValue == 90 ? 65 : asciiValue + 1
            encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? char))
        }
    }
    return encodedMessage
}
```
encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? char)) // cannot convert value of type 'Character' to expected argument type 'UnicodeScalar' (aka 'Unicode.Scalar')
encodedMessage.append(Character(UnicodeScalar(newAsciiValue) ?? char)) // cannot convert value of type 'Character' to expected argument type 'UnicodeScalar' (aka 'Unicode.Scalar')

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isUppercase {
            let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!)
            encodedMessage.append(newChar)
        } else {
            let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!)
            encodedMessage.append(newChar)
        }
    }
    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.isUppercase {
            let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!)
            encodedMessage.append(newChar)
        } else {
            let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!)
            encodedMessage.append(newChar)
        }
    }
    return encodedMessage
}
```
let newChar = Character(UnicodeScalar(char.asciiValue! + 1)!) // cannot force unwrap value of non-optional type 'UnicodeScalar' (aka 'Unicode.Scalar')
let newChar = Character(UnicodeScalar(char.asciiValue! - 1)!) // cannot force unwrap value of non-optional type 'UnicodeScalar' (aka 'Unicode.Scalar')

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

} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

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

} // missing return in global function expected to return 'Int'

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

} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call

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

} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for num in lst {
        if isPrime(num) && num > largestPrime {
            largestPrime = num
        }
    }
    return sumDigits(largestPrime)
}

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

func sumDigits(num: Int) -> Int {
    var sum = 0
    var temp = num
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```
if isPrime(num) && num > largestPrime { // missing argument label 'num:' in call
return sumDigits(largestPrime) // missing argument label 'num:' in call

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```

 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```

 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```

 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```

 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        if isPrime(number: i) {
            primes.append(i)
        }
    }
    return primes
}

func isPrime(number: Int) -> Bool {
    guard number > 1 else { 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] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        if isPrime(number: i) {
            primes.append(i)
        }
    }
    return primes
}

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

 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    let product = aUnitDigit * bUnitDigit
    return product
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    let product = aUnitDigit * bUnitDigit
    return product
}
```

func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return (unitDigitA * unitDigitB) % 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 {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return (unitDigitA * unitDigitB) % 10
}
```

 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return abs(unitDigitA * unitDigitB)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return abs(unitDigitA * unitDigitB)
}
```

func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    let product = aUnitDigit * bUnitDigit
    return product
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    let product = aUnitDigit * bUnitDigit
    return product
}
```

func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    let product = unitDigitA * unitDigitB
    return product
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    let product = unitDigitA * unitDigitB
    return product
}
```

func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * 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 {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * b) % 10
}
```

let aUnitDigit = abs(a) % 10 // initialization of immutable value 'aUnitDigit' was never used; consider replacing with assignment to '_' or removing it
let bUnitDigit = abs(b) % 10 // initialization of immutable value 'bUnitDigit' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * 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 {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * b) % 10
}
```
let aUnitDigit = abs(a) % 10 // initialization of immutable value 'aUnitDigit' was never used; consider replacing with assignment to '_' or removing it
let bUnitDigit = abs(b) % 10 // initialization of immutable value 'bUnitDigit' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return abs(unitDigitA * unitDigitB)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return abs(unitDigitA * unitDigitB)
}
```

func multiply(a: Int, b: Int) -> Int {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * 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 {
    let aUnitDigit = abs(a) % 10
    let bUnitDigit = abs(b) % 10
    return (a * b) % 10
}
```

let aUnitDigit = abs(a) % 10 // initialization of immutable value 'aUnitDigit' was never used; consider replacing with assignment to '_' or removing it
let bUnitDigit = abs(b) % 10 // initialization of immutable value 'bUnitDigit' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return (a * 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 {
    let unitDigitA = abs(a) % 10
    let unitDigitB = abs(b) % 10
    return (a * b) % 10
}
```
let unitDigitA = abs(a) % 10 // initialization of immutable value 'unitDigitA' was never used; consider replacing with assignment to '_' or removing it
let unitDigitB = abs(b) % 10 // initialization of immutable value 'unitDigitB' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    let vowels = ["A", "E", "I", "O", "U"]
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(String(char)) {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    let vowels = ["A", "E", "I", "O", "U"]
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(String(char)) {
            count += 1
        }
    }
    return count
}
```

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    let vowels = "AEIOU"
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    let vowels = "AEIOU"
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```

func countUpper(s: String) -> Int {
    let vowels = Set<Character>("AEIOU")
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    let vowels = Set<Character>("AEIOU")
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```

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 {
    let vowels = "AEIOU"
    var count = 0
    for (index, char) in s.enumerated() where index % 2 == 0 && vowels.contains(char) {
        count += 1
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    let vowels = "AEIOU"
    var count = 0
    for (index, char) in s.enumerated() where index % 2 == 0 && vowels.contains(char) {
        count += 1
    }
    return count
}
```

func countUpper(s: String) -> Int {
    let vowels = Set<Character>("AEIOU")
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    let vowels = Set<Character>("AEIOU")
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && vowels.contains(char) {
            count += 1
        }
    }
    return count
}
```

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floorValue = floor(number)
    let ceilValue = ceil(number)
    let absFloor = abs(number - floorValue)
    let absCeil = abs(number - ceilValue)
    if absFloor < absCeil {
        return Int(floorValue)
    } else {
        return Int(ceilValue)
    }
}
```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 floorValue = floor(number)
    let ceilValue = ceil(number)
    let absFloor = abs(number - floorValue)
    let absCeil = abs(number - ceilValue)
    if absFloor < absCeil {
        return Int(floorValue)
    } else {
        return Int(ceilValue)
    }
}
```

let floorValue = floor(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceilValue = ceil(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = Int(floor(number))
    let ceil = Int(ceil(number))
    let absFloor = abs(number - Double(floor))
    let absCeil = abs(number - Double(ceil))
    if absFloor <= absCeil {
        return floor
    } else {
        return 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 = Int(floor(number))
    let ceil = Int(ceil(number))
    let absFloor = abs(number - Double(floor))
    let absCeil = abs(number - Double(ceil))
    if absFloor <= absCeil {
        return floor
    } else {
        return ceil
    }
}
```

let floor = Int(floor(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceil = Int(ceil(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let absFloor = abs(number - Double(floor)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let absCeil = abs(number - Double(ceil)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number!)
    let absoluteDifference = abs(rounded - number!)
    let nextNumber = rounded + 1
    let nextAbsoluteDifference = abs(nextNumber - number!)
    if absoluteDifference < nextAbsoluteDifference {
        return Int(rounded)
    } else {
        return Int(nextNumber)
    }
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number!)
    let absoluteDifference = abs(rounded - number!)
    let nextNumber = rounded + 1
    let nextAbsoluteDifference = abs(nextNumber - number!)
    if absoluteDifference < nextAbsoluteDifference {
        return Int(rounded)
    } else {
        return Int(nextNumber)
    }
}
```

 // XCTAssertTrue failed

func closestInteger(value: String) -> Int {
    let number = Double(value) ?? 0
    let rounded = round(number)
    let floor = floor(number)
    let ceil = ceil(number)
    
    if abs(number - rounded) == abs(number - floor) {
        return number > 0 ? Int(ceil) : Int(floor)
    } else if abs(number - rounded) < abs(number - floor) {
        return Int(rounded)
    } else {
        return 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 rounded = round(number)
    let floor = floor(number)
    let ceil = ceil(number)
    
    if abs(number - rounded) == abs(number - floor) {
        return number > 0 ? Int(ceil) : Int(floor)
    } else if abs(number - rounded) < abs(number - floor) {
        return Int(rounded)
    } else {
        return Int(ceil)
    }
}
```

 // XCTAssertTrue failed

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number!)
    return Int(rounded)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number!)
    return Int(rounded)
}
```

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let roundedUp = ceil(number)
    let roundedDown = floor(number)
    if abs(roundedUp - number) < abs(roundedDown - number) {
        return Int(roundedUp)
    } else {
        return Int(roundedDown)
    }
}
```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 roundedUp = ceil(number)
    let roundedDown = floor(number)
    if abs(roundedUp - number) < abs(roundedDown - number) {
        return Int(roundedUp)
    } else {
        return Int(roundedDown)
    }
}
```

let roundedUp = ceil(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let roundedDown = floor(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```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 = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```

let floor = Int(floor(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceil = Int(ceil(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```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 = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```
let floor = Int(floor(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceil = Int(ceil(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```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 = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return number > 0 ? ceil : floor
    } else {
        return number > 0 ? ceil : floor
    }
}
```
let floor = Int(floor(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceil = Int(ceil(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return number > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return abs(number) > 0 ? ceil : floor
    } else {
        return abs(number - floor) < abs(number - ceil) ? floor : 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 = Int(floor(number))
    let ceil = Int(ceil(number))
    if abs(number - floor) == abs(number - ceil) {
        return abs(number) > 0 ? ceil : floor
    } else {
        return abs(number - floor) < abs(number - ceil) ? floor : ceil
    }
}
```

let floor = Int(floor(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let ceil = Int(ceil(number)) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return abs(number) > 0 ? ceil : floor // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func makeAPile(n: Int) -> [Int] {
    var result: [Int] = []
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1
        if currentLevel % 2 == 0 {
            currentLevel += 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1
        if currentLevel % 2 == 0 {
            currentLevel += 1
        }
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1 - currentLevel % 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1 - currentLevel % 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1 - currentLevel % 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 1 - currentLevel % 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 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 currentLevel = n
    while currentLevel > 0 {
        result.append(currentLevel)
        currentLevel += 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var stones = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        stones.append(currentLevel)
        currentLevel += 2
    }
    return stones
}
```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 stones = [Int]()
    var currentLevel = n
    while currentLevel > 0 {
        stones.append(currentLevel)
        currentLevel += 2
    }
    return stones
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 2
    }
    return result
}
```

func wordsString(s: String) -> [String] {
    // Your code here
}
```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] {
    // Your code here
}
```

} // missing return in global function expected to return '[String]'

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```

 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```

 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```

 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    // Your code here
}
```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] {
    // Your code here
}
```

} // missing return in global function expected to return '[String]'

func wordsString(s: String) -> [String] {
    // Your code here
}
```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] {
    // Your code here
}
```

} // missing return in global function expected to return '[String]'

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```

 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    // Your code here
}
```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] {
    // Your code here
}
```

} // missing return in global function expected to return '[String]'

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```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: ", ").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
}
```

 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 == 0 && x < y {
        result = x
    } else if y % 2 == 0 && y < x {
        result = y
    } else if x % 2 != 0 && x < y {
        result = x + 1
    } else if y % 2 != 0 && y < x {
        result = y + 1
    } else if x % 2 != 0 && x > y {
        result = x - 1
    } else if y % 2 != 0 && y > x {
        result = y - 1
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 == 0 && x < y {
        result = x
    } else if y % 2 == 0 && y < x {
        result = y
    } else if x % 2 != 0 && x < y {
        result = x + 1
    } else if y % 2 != 0 && y < x {
        result = y + 1
    } else if x % 2 != 0 && x > y {
        result = x - 1
    } else if y % 2 != 0 && y > x {
        result = y - 1
    }
    return result
}
```

 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```

 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var evenNumbers = [Int]()
    for i in x...y {
        if i % 2 == 0 {
            evenNumbers.append(i)
        }
    }
    if evenNumbers.isEmpty {
        return -1
    } else {
        return evenNumbers.max()!
    }
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var evenNumbers = [Int]()
    for i in x...y {
        if i % 2 == 0 {
            evenNumbers.append(i)
        }
    }
    if evenNumbers.isEmpty {
        return -1
    } else {
        return evenNumbers.max()!
    }
}
```

 // Fatal error: Range requires lowerBound <= upperBound

func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```

} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if x % 2 == 0 && x < y {
        result = x
    } else if x % 2 != 0 && x >= y {
        result = x - 1
    } else if x % 2 != 0 && x < y {
        result = x - 2
    }
    return result
}
```

 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 != 0 && y % 2 != 0 {
        result = -1
    } else if x % 2 == 0 && y % 2 != 0 {
        result = x
    } else if x % 2 != 0 && y % 2 == 0 {
        result = y
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 != 0 && y % 2 != 0 {
        result = -1
    } else if x % 2 == 0 && y % 2 != 0 {
        result = x
    } else if x % 2 != 0 && y % 2 == 0 {
        result = y
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 == 0 && x < y {
        result = x
    } else if y % 2 == 0 && y < x {
        result = y
    } else if x % 2 != 0 && x < y {
        result = x + 1
    } else if y % 2 != 0 && y < x {
        result = y + 1
    }
    return result
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    } else if x % 2 == 0 && x < y {
        result = x
    } else if y % 2 == 0 && y < x {
        result = y
    } else if x % 2 != 0 && x < y {
        result = x + 1
    } else if y % 2 != 0 && y < x {
        result = y + 1
    }
    return result
}
```
 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let rounded = sum.rounded(.towardZero)
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

func sumOfDigits(n: Int) -> Int {
    var sum = 0
    var num = n
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}

func productOfDigits(n: Int) -> Int {
    var product = 1
    var num = n
    while num > 0 {
        product *= num % 10
        num /= 10
    }
    return product
}

func factorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let rounded = sum.rounded(.towardZero)
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

// You are given a positive integer n, and your task is to compute the
// sum of the digits of n.
// Example:
// sumOfDigits(n: 12345) == 15
// sumOfDigits(n: 987654321) == 45
func sumOfDigits(n: Int) -> Int {
    var sum = 0
    var num = n
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}

// You are given a positive integer n, and your task is to compute the
// product of the digits of n.
// Example:
// productOfDigits(n: 12345) == 120
// productOfDigits(n: 987654321) == 362880
func productOfDigits(n: Int) -> Int {
    var product = 1
    var num = n
    while num > 0 {
        product *= num % 10
        num /= 10
    }
    return product
}

// You are given a positive integer n, and your task is to compute the
// factorial of n.
// Example:
// factorial(n: 5) == 120
// factorial(n: 10) == 3628800
func factorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

// You are given a positive integer n, and your task is to compute the
// sum of the digits of n.
// Example:
// sumOfDigits(n: 12345) == 15
// sumOfDigits(n: 987654321) == 45
func sumOfDigits(n: Int) -> Int {
    var sum = 0
    var num = n
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}

// You are given a positive integer n, and your task is to compute the
// product of the digits of n.
// Example:
// productOfDigits(n: 12345) == 120
// productOfDigits(n: 987654321) == 362880
func productOfDigits(n: Int) -> Int {
    var product = 1
    var num = n
    while num > 0 {
        product *= num % 10
        num /= 10
    }
    return product
}

// You are given a positive integer n, and your task is to compute the
// factorial of n.
// Example:
// factorial(n: 5) == 120
// factorial(n: 10) == 3628800
func factorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

// You are given a positive integer n, and your task is to compute the
// sum of the digits of n.
// Example:
// sumOfDigits(n: 12345) == 15
// sumOfDigits(n: 987654321) == 45
func sumOfDigits(n: Int) -> Int {
    var sum = 0
    var num = n
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}

// You are given a positive integer n, and your task is to compute the
// product of the digits of n.
// Example:
// productOfDigits(n: 12345) == 120
// productOfDigits(n: 987654321) == 362880
func productOfDigits(n: Int) -> Int {
    var product = 1
    var num = n
    while num > 0 {
        product *= num % 10
        num /= 10
    }
    return product
}

// You are given a positive integer n, and your task is to compute the
// factorial of n.
// Example:
// factorial(n: 
let rounded = sum.rounded(.towardZero) // cannot infer contextual base in reference to member 'towardZero'
let rounded = sum.rounded(.towardZero) // value of type 'Int' has no member 'rounded'

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = sum / (m - n + 1)
    let binary = String(format: "0b%b", avg)
    return .success(binary)
}

func isPossibleSplit(s: String) -> Bool {
    var prev = Int(s[0])!
    var count = 1
    for i in 1..<s.count {
        let curr = Int(s[i])!
        if curr == prev - 1 {
            count += 1
        } else {
            if count > 1 {
                count = 1
            } else {
                return false
            }
        }
        prev = curr
    }
    return count > 1
}

func smallestStringWithSwaps(s: String, k: Int) -> String {
    let chars = Array(s)
    var result = Array(repeating: "", count: chars.count)
    var visited = Array(repeating: false, count: chars.count)
    for i in 0..<chars.count {
        if !visited[i] {
            var stack = [Int]()
            var visited = Array(repeating: false, count: chars.count)
            stack.append(i)
            visited[i] = true
            while !stack.isEmpty {
                let curr = stack.removeLast()
                result[curr] = String(chars[curr])
                for j in 0..<chars.count {
                    if !visited[j] && abs(curr - j) <= k {
                        stack.append(j)
                        visited[j] = true
                    }
                }
            }
        }
    }
    return result.joined()
}
```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> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = sum / (m - n + 1)
    let binary = String(format: "0b%b", avg)
    return .success(binary)
}

// You are given a string s that consists of only digits.
// Check if we can split s into two or more non-empty substrings such that the
// numerical values of the substrings are in descending order and the difference
// between numerical values of every two adjacent substrings is equal to 1.
// For example, the string s = "0090089" can be split into ["0090", "089"] with
// the numerical values [90,89]. The values are in descending order and adjacent
// values differ by 1, so this way is valid.
// Another example, the string s = "001" can be split into ["0", "01"], ["00",
// "1"], or ["0", "0", "1"]. However all the ways are invalid because they have
// numerical values [0,1], [0,1], and [0,0,1] respectively, all of which are not
// in descending order.
// Return true if it is possible to split s​​​​​​ as described above, or false
// otherwise.
// A substring is a contiguous sequence of characters in a string.
// Example:
// isPossibleSplit(s: "001") == true
// isPossibleSplit(s: "00") == false
// isPossibleSplit(s: "01") == true
func isPossibleSplit(s: String) -> Bool {
    var prev = Int(s[0])!
    var count = 1
    for i in 1..<s.count {
        let curr = Int(s[i])!
        if curr == prev - 1 {
            count += 1
        } else {
            if count > 1 {
                count = 1
            } else {
                return false
            }
        }
        prev = curr
    }
    return count > 1
}

// You are given a string s and an integer k. You can choose one of the first k
// letters of s and append it at the end of the string..
// Return the lexicographically smallest string you could have after applying the
// mentioned step any number of moves.
// Example:
// smallestStringWithSwaps(s: "dcab", k: 2) == "bacd"
// smallestStringWithSwaps(s: "deed", k: 1) == "ddde"
// smallestStringWithSwaps(s: "aa", k: 2) == "aa"
func smallestStringWithSwaps(s: String, k: Int) -> String {
    let chars = Array(s)
    var result = Array(repeating: "", count: chars.count)
    var visited = Array(repeating: false, count: chars.count)
    for i in 0..<chars.count {
        if !visited[i] {
            var stack = [Int]()
            var visited = Array(repeating: false, count: chars.count)
            stack.append(i)
            visited[i] = true
            while !stack.isEmpty {
                let curr = stack.removeLast()
                result[curr] = String(chars[curr])
                for j in 0..<chars.count {
                    if !visited[j] && abs(curr - j) <= k {
                        stack.append(j)
                        visited[j] = true
                    }
                }
            }
        }
    }
    return result.joined()
}

// You are given a string s and an integer k. You can choose any character of
// the string and change it to any other uppercase English character. You can
// perform this operation at most k times.
// Return the length of the longest substring containing the same letter you can
// get after performing the above operations.
// Example:
// longestRepeatingCharacterReplacement(s: "ABAB", k: 2) == 4
// longestRepeatingCharacterReplacement(s: "AABABBA", k: 1) == 4
// longestRepeatingCharacterReplacement(s: "AABABBA", k: 0) == 2
func longestRepeatingCharacterReplacement(s: String, k: Int) -> Int {
    var count = [Character: Int]()
    var maxCount = 0
    var maxLength = 0
    var left = 0
    for (right, char) in s.enumerated() {
        count[char, default: 0] += 1
        maxCount = max(maxCount, count[char]!)
        if right - left + 1 - maxCount > k {
            count[s[left]]!
var prev = Int(s[0])! // no exact matches in call to subscript
let curr = Int(s[i])! // no exact matches in call to subscript
var visited = Array(repeating: false, count: chars.count) // variable 'visited' was never mutated; consider changing to 'let' constant

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    return .success(binary)
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    return .success(binary)
}
```
 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    } else {
        let avg = Double(n + m) / 2
        let rounded = Int(round(avg))
        return .success("0b" + 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> {
    if n > m {
        return .failure(-1)
    } else {
        let avg = Double(n + m) / 2
        let rounded = Int(round(avg))
        return .success("0b" + String(rounded, radix: 2))
    }
}
```

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(sum, radix: 2)
    return .success(binary)
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(sum, radix: 2)
    return .success(binary)
}
```

 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = sum / (m - n + 1)
    let binary = String(format: "%b", avg)
    return .success(binary)
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = sum / (m - n + 1)
    let binary = String(format: "%b", avg)
    return .success(binary)
}
```
 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = Double(sum) / Double(m - n + 1)
    let rounded = Int(round(avg))
    return .success(String(format: "0b%b", rounded))
}

func roundedAvg(n: Int) -> Result<String, Int> {
    if n > 100 {
        return .failure(-1)
    }
    let sum = (n * (n + 1)) / 2
    let avg = Double(sum) / Double(n)
    let rounded = Int(round(avg))
    return .success(String(format: "0b%b", rounded))
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) * (m - n + 1) / 2
    let avg = Double(sum) / Double(m - n + 1)
    let rounded = Int(round(avg))
    return .success(String(format: "0b%b", rounded))
}

// You are given a positive integer n, and your task is to compute the
// average of the integers from 1 through n (including 1 and n).
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than 100, return -1.
// Example:
// roundedAvg(n: 1) == .success("0b1")
// roundedAvg(n: 2) == .success("0b10")
// roundedAvg(n: 3) == .success("0b11")
// roundedAvg(n: 4) == .success("0b100")
// roundedAvg(n: 100) == .failure(-1)
// roundedAvg(n: 101) == .success("0b11001100")
func roundedAvg(n: Int) -> Result<String, Int> {
    if n > 100 {
        return .failure(-1)
    }
    let sum = (n * (n + 1)) / 2
    let avg = Double(sum) / Double(n)
    let rounded = Int(round(avg))
    return .success(String(format: "0b%b", rounded))
}
```

 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let avg = Double(n + m) / 2
    let rounded = Int(round(avg))
    return .success("0b" + 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> {
    if n > m {
        return .failure(-1)
    }
    let avg = Double(n + m) / 2
    let rounded = Int(round(avg))
    return .success("0b" + String(rounded, radix: 2))
}
```

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(format: "0b%b", sum)
    return .success(binary)
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let sum = (n + m) / 2
    let binary = String(format: "0b%b", sum)
    return .success(binary)
}
```
 // XCTAssertTrue failed

extension Int: Error {

}

func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let avg = (n + m) / 2
    let binary = String(format: "%b", avg)
    return .success(binary)
}
```swift
extension Int: Error {

}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    if n > m {
        return .failure(-1)
    }
    let avg = (n + m) / 2
    let binary = String(format: "%b", avg)
    return .success(binary)
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var temp = num
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var temp = num
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var isEven = false
        var temp = num
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var isEven = false
        var temp = num
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```

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

 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```

num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var isEven = false
        while num > 0 {
            let digit = num % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            num /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```

num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

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

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for num in x {
        var temp = num
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    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 num in x {
        var temp = num
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp /= 10
        }
        if !isEven {
            result.append(num)
        }
    }
    return result.sorted()
}
```

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

func byLength(arr: [Int]) -> [String] {
    // Filter out any non-integer values and sort the remaining integers
    let filteredAndSorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    
    // Reverse the sorted array
    let reversed = filteredAndSorted.reversed()
    
    // Map each integer to its corresponding name
    let names = reversed.map { String($0) }
    
    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] {
    // Filter out any non-integer values and sort the remaining integers
    let filteredAndSorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    
    // Reverse the sorted array
    let reversed = filteredAndSorted.reversed()
    
    // Map each integer to its corresponding name
    let names = reversed.map { String($0) }
    
    return names
}
```

 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for num in arr {
        if num >= 1 && num <= 9 {
            result.append(num == 1 ? "One" : num == 2 ? "Two" : num == 3 ? "Three" : num == 4 ? "Four" : num == 5 ? "Five" : num == 6 ? "Six" : num == 7 ? "Seven" : num == 8 ? "Eight" : "Nine")
        }
    }
    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 num in arr {
        if num >= 1 && num <= 9 {
            result.append(num == 1 ? "One" : num == 2 ? "Two" : num == 3 ? "Three" : num == 4 ? "Four" : num == 5 ? "Five" : num == 6 ? "Six" : num == 7 ? "Seven" : num == 8 ? "Eight" : "Nine")
        }
    }
    return result.reversed()
}
```

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

func byLength(arr: [Int]) -> [String] {
    let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    let names = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
    var result = [String]()
    for num in arr {
        if numbers.contains(num) {
            result.append(names[num - 1])
        }
    }
    return result.reversed()
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    let names = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
    var result = [String]()
    for num in arr {
        if numbers.contains(num) {
            result.append(names[num - 1])
        }
    }
    return result.reversed()
}
```

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

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

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

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

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

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

 // XCTAssertTrue failed

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

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(_ num: Int) -> Bool {
    let str = String(num)
    return str == String(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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(_ num: Int) -> Bool {
    let str = String(num)
    return str == String(str.reversed())
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

// Helper function to check if a number is a palindrome
func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```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 evenCount = 0
    var oddCount = 0
    for i in 1...n {
        if isPalindrome(number: i) {
            if i % 2 == 0 {
                evenCount += 1
            } else {
                oddCount += 1
            }
        }
    }
    return (evenCount, oddCount)
}

func isPalindrome(number: Int) -> Bool {
    let str = String(number)
    let reversedStr = String(str.reversed())
    return str == reversedStr
}
```

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var temp = num
        while temp != 0 {
            sum += temp % 10
            temp /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var temp = num
        while temp != 0 {
            sum += temp % 10
            temp /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = num
        while current != 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = num
        while current != 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = num
        while current != 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = num
        while current != 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += abs(n % 10)
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += abs(n % 10)
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = abs(num)
        while current > 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var current = abs(num)
        while current > 0 {
            sum += current % 10
            current /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var currentNum = num
        while currentNum != 0 {
            sum += currentNum % 10
            currentNum /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += abs(n % 10)
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += abs(n % 10)
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```

 // XCTAssertTrue failed

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

func moveOneBall(arr: [Int]) -> Bool {
    if arr.isEmpty { return true }
    var sortedArr = arr.sorted()
    for i in 0..<arr.count {
        if arr[i] != sortedArr[i] {
            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 {
    if arr.isEmpty { return true }
    var sortedArr = arr.sorted()
    for i in 0..<arr.count {
        if arr[i] != sortedArr[i] {
            return false
        }
    }
    return true
}
```
var sortedArr = arr.sorted() // variable 'sortedArr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

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

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

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

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

var sortedArr = arr.sorted() // variable 'sortedArr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

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

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

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with all odd numbers in lst1, return "YES"
    if evenCountInLst2 >= oddCountInLst1 {
        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 {
    // Count the number of odd elements in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with all odd numbers in lst1, return "YES"
    if evenCountInLst2 >= oddCountInLst1 {
        return "YES"
    } else {
        return "NO"
    }
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // return "YES". Otherwise, return "NO".
    return evenCount >= oddCount ? "YES" : "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // return "YES". Otherwise, return "NO".
    return evenCount >= oddCount ? "YES" : "NO"
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}

func check() {
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO")
    assert(exchange(lst1: [2, 4, 6, 8], lst2: [1, 3, 5, 7]) == "YES")
    assert(exchange(lst1: [1, 3, 5, 7], lst2: [2, 4, 6, 8]) == "NO")
    assert(exchange(lst1: [1, 2, 3, 4, 5], lst2: [2, 4, 6, 8, 10]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4, 5], lst2: [1, 3, 5, 7, 9]) == "NO")
    print("All checks passed.")
}
```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 {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}

// Check function to verify the correctness of the solution
func check() {
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO")
    assert(exchange(lst1: [2, 4, 6, 8], lst2: [1, 3, 5, 7]) == "YES")
    assert(exchange(lst1: [1, 3, 5, 7], lst2: [2, 4, 6, 8]) == "NO")
    assert(exchange(lst1: [1, 2, 3, 4, 5], lst2: [2, 4, 6, 8, 10]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4, 5], lst2: [1, 3, 5, 7, 9]) == "NO")
    print("All checks passed.")
}

// Run the check function to verify the solution
check()
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even elements in lst2 to exchange with all odd elements in lst1,
    // then it is possible to make lst1 an array of only even numbers.
    if evenCountInLst2 >= oddCountInLst1 {
        return "YES"
    } else {
        return "NO"
    }
}

func check() {
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO")
    assert(exchange(lst1: [2, 4, 6, 8], lst2: [1, 3, 5, 7]) == "YES")
    assert(exchange(lst1: [1, 3, 5, 7], lst2: [2, 4, 6, 8]) == "NO")
    print("All checks pass.")
}
```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 {
    // Count the number of odd elements in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even elements in lst2 to exchange with all odd elements in lst1,
    // then it is possible to make lst1 an array of only even numbers.
    if evenCountInLst2 >= oddCountInLst1 {
        return "YES"
    } else {
        return "NO"
    }
}

// Check function to verify the correctness of the solution
func check() {
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES")
    assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO")
    assert(exchange(lst1: [2, 4, 6, 8], lst2: [1, 3, 5, 7]) == "YES")
    assert(exchange(lst1: [1, 3, 5, 7], lst2: [2, 4, 6, 8]) == "NO")
    print("All checks pass.")
}

// Run the check function to verify the solution
check()
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers, return "YES"
    if evenCount >= oddCount {
        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 {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers, return "YES"
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd numbers in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even numbers in lst2 to exchange with all odd numbers in lst1,
    // then it is possible to make lst1 all even numbers.
    if evenCountInLst2 >= oddCountInLst1 {
        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 {
    // Count the number of odd numbers in lst1
    let oddCountInLst1 = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCountInLst2 = lst2.filter { $0 % 2 == 0 }.count
    
    // If there are enough even numbers in lst2 to exchange with all odd numbers in lst1,
    // then it is possible to make lst1 all even numbers.
    if evenCountInLst2 >= oddCountInLst1 {
        return "YES"
    } else {
        return "NO"
    }
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        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 {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // return "YES", otherwise return "NO"
    return oddCount <= evenCount ? "YES" : "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // return "YES", otherwise return "NO"
    return oddCount <= evenCount ? "YES" : "NO"
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        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 {
    // Count the number of odd elements in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even elements in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even elements in lst2 to exchange with lst1's odd elements,
    // it is possible to make lst1 an array of only even numbers.
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}
```

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers, return "YES"
    if evenCount >= oddCount {
        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 {
    // Count the number of odd numbers in lst1
    let oddCount = lst1.filter { $0 % 2 != 0 }.count
    // Count the number of even numbers in lst2
    let evenCount = lst2.filter { $0 % 2 == 0 }.count
    // If there are enough even numbers in lst2 to exchange with lst1's odd numbers, return "YES"
    if evenCount >= oddCount {
        return "YES"
    } else {
        return "NO"
    }
}
```

func histogram(test: String) -> [String : Int] {
    var letterCounts: [String : Int] = [:]
    let words = test.components(separatedBy: " ")
    for word in words {
        let letterCount = word.reduce(into: [Character : Int]()) { $0[$1, default: 0] += 1 }
        for (letter, count) in letterCount {
            if let existingCount = letterCounts[letter] {
                letterCounts[letter] = existingCount + count
            } else {
                letterCounts[letter] = count
            }
        }
    }
    return letterCounts.filter { $0.value > 1 }
}
```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 letterCounts: [String : Int] = [:]
    let words = test.components(separatedBy: " ")
    for word in words {
        let letterCount = word.reduce(into: [Character : Int]()) { $0[$1, default: 0] += 1 }
        for (letter, count) in letterCount {
            if let existingCount = letterCounts[letter] {
                letterCounts[letter] = existingCount + count
            } else {
                letterCounts[letter] = count
            }
        }
    }
    return letterCounts.filter { $0.value > 1 }
}
```
if let existingCount = letterCounts[letter] { // cannot convert value of type 'Character' to expected argument type 'String'
letterCounts[letter] = existingCount + count // cannot convert value of type 'Character' to expected argument type 'String'
letterCounts[letter] = count // cannot convert value of type 'Character' to expected argument type 'String'

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()
    
    for letter in test.lowercased().split(separator: " ") {
        let count = letterCounts[letter] ?? 0
        letterCounts[letter] = count + 1
        if count + 1 > maxCount {
            maxCount = count + 1
            result = [letter: maxCount]
        } else if count + 1 == maxCount {
            result[letter] = maxCount
        }
    }
    
    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 letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()
    
    for letter in test.lowercased().split(separator: " ") {
        let count = letterCounts[letter] ?? 0
        letterCounts[letter] = count + 1
        if count + 1 > maxCount {
            maxCount = count + 1
            result = [letter: maxCount]
        } else if count + 1 == maxCount {
            result[letter] = maxCount
        }
    }
    
    return result
}
```
let count = letterCounts[letter] ?? 0 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
letterCounts[letter] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result = [letter: maxCount] // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected dictionary key type 'String'
result[letter] = maxCount // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()
    
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }
    
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    
    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 letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()
    
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }
    
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    
    return result
}
```

for letter in test.lowercased().characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String: Int]()
    var maxCount = 0
    var maxLetters = [String]()
    
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
        } else {
            letterCounts[String(letter)] = 1
        }
        
        if letterCounts[String(letter)]! > maxCount {
            maxCount = letterCounts[String(letter)]!
            maxLetters = [String(letter)]
        } else if letterCounts[String(letter)]! == maxCount {
            maxLetters.append(String(letter))
        }
    }
    
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}
```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 letterCounts = [String: Int]()
    var maxCount = 0
    var maxLetters = [String]()
    
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
        } else {
            letterCounts[String(letter)] = 1
        }
        
        if letterCounts[String(letter)]! > maxCount {
            maxCount = letterCounts[String(letter)]!
            maxLetters = [String(letter)]
        } else if letterCounts[String(letter)]! == maxCount {
            maxLetters.append(String(letter))
        }
    }
    
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}

// Test cases
print(histogram(test: "a b c")) // ["a" : 1, "b" : 1, "c" : 1]
print(histogram(test: "a b b a")) // ["a" : 2, "b" : 2]
print(histogram(test: "a b c a b")) // ["a" : 2, "b" : 2]
print(histogram(test: "b b b b a")) // ["b" : 4]
print(histogram(test: "")) // [:] as [String : Int]
```

for letter in test.lowercased().characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()

    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }

    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }

    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 letterCounts = [String: Int]()
    var maxCount = 0
    var result = [String: Int]()

    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }

    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }

    return result
}
```

for letter in test.lowercased().characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var letterCounts: [String : Int] = [:]
    var maxCount = 0
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }
    var result: [String : Int] = [:]
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    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 letterCounts: [String : Int] = [:]
    var maxCount = 0
    for letter in test.lowercased().characters {
        if let count = letterCounts[String(letter)] {
            letterCounts[String(letter)] = count + 1
            if count + 1 > maxCount {
                maxCount = count + 1
            }
        } else {
            letterCounts[String(letter)] = 1
        }
    }
    var result: [String : Int] = [:]
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    return result
}
```

for letter in test.lowercased().characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var letterCounts: [String : Int] = [:]
    let words = test.split(separator: " ").map { String($0) }
    for word in words {
        if let count = letterCounts[word] {
            letterCounts[word] = count + 1
        } else {
            letterCounts[word] = 1
        }
    }
    let maxCount = letterCounts.values.max() ?? 0
    var result: [String : Int] = [:]
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    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 letterCounts: [String : Int] = [:]
    let words = test.split(separator: " ").map { String($0) }
    for word in words {
        if let count = letterCounts[word] {
            letterCounts[word] = count + 1
        } else {
            letterCounts[word] = 1
        }
    }
    let maxCount = letterCounts.values.max() ?? 0
    var result: [String : Int] = [:]
    for (letter, count) in letterCounts {
        if count == maxCount {
            result[letter] = count
        }
    }
    return result
}
```

func histogram(test: String) -> [String : Int] {
    var letterCount = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = letterCount[word] {
            letterCount[word] = count + 1
        } else {
            letterCount[word] = 1
        }
    }
    var maxCount = 0
    var maxLetters = [String]()
    for (letter, count) in letterCount {
        if count > maxCount {
            maxCount = count
            maxLetters = [letter]
        } else if count == maxCount {
            maxLetters.append(letter)
        }
    }
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}
```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 letterCount = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = letterCount[word] {
            letterCount[word] = count + 1
        } else {
            letterCount[word] = 1
        }
    }
    var maxCount = 0
    var maxLetters = [String]()
    for (letter, count) in letterCount {
        if count > maxCount {
            maxCount = count
            maxLetters = [letter]
        } else if count == maxCount {
            maxLetters.append(letter)
        }
    }
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        let letters = Array(word)
        for letter in letters {
            if let count = letterCounts[String(letter)] {
                letterCounts[String(letter)] = count + 1
            } else {
                letterCounts[String(letter)] = 1
            }
        }
    }
    var maxCount = 0
    var maxLetters = [String]()
    for (letter, count) in letterCounts {
        if count > maxCount {
            maxCount = count
            maxLetters = [letter]
        } else if count == maxCount {
            maxLetters.append(letter)
        }
    }
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}
```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 letterCounts = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        let letters = Array(word)
        for letter in letters {
            if let count = letterCounts[String(letter)] {
                letterCounts[String(letter)] = count + 1
            } else {
                letterCounts[String(letter)] = 1
            }
        }
    }
    var maxCount = 0
    var maxLetters = [String]()
    for (letter, count) in letterCounts {
        if count > maxCount {
            maxCount = count
            maxLetters = [letter]
        } else if count == maxCount {
            maxLetters.append(letter)
        }
    }
    return Dictionary(uniqueKeysWithValues: zip(maxLetters, Array(repeating: maxCount, count: maxLetters.count)))
}
```

func histogram(test: String) -> [String : Int] {
    var letterCounts = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        var count = 0
        for char in word {
            if char.isLetter {
                count += 1
            }
        }
        if let existingCount = letterCounts[word] {
            letterCounts[word] = existingCount + count
        } else {
            letterCounts[word] = count
        }
    }
    return letterCounts.filter { $0.value > 1 }
}
```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 letterCounts = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        var count = 0
        for char in word {
            if char.isLetter {
                count += 1
            }
        }
        if let existingCount = letterCounts[word] {
            letterCounts[word] = existingCount + count
        } else {
            letterCounts[word] = count
        }
    }
    return letterCounts.filter { $0.value > 1 }
}
```
 // XCTAssertTrue failed

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if !c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == 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()))
}
```

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

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

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

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

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let sArray = Array(s)
    let cArray = Array(c)
    var result = ""
    for i in 0..<sArray.count {
        if !cArray.contains(sArray[i]) {
            result.append(sArray[i])
        }
    }
    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 sArray = Array(s)
    let cArray = Array(c)
    var result = ""
    for i in 0..<sArray.count {
        if !cArray.contains(sArray[i]) {
            result.append(sArray[i])
        }
    }
    return (result, result == String(result.reversed()))
}
```

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

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

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

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

func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```

let oddCount = str.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

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

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for i in 0..<lst.count {
        let count = lst[i].filter { $0.isOdd }.count
        result.append("the number of odd elements \(count) in the string \(i) of the input.")
    }
    return result
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for i in 0..<lst.count {
        let count = lst[i].filter { $0.isOdd }.count
        result.append("the number of odd elements \(count) in the string \(i) of the input.")
    }
    return result
}
```

let count = lst[i].filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```

let oddCount = str.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}

func isOdd(_ char: Character) -> Bool {
    return Int(char.asciiValue!) % 2 == 1
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}

// Helper function to check if a character is odd
func isOdd(_ char: Character) -> Bool {
    return Int(char.asciiValue!) % 2 == 1
}
```

let oddCount = str.filter { $0.isOdd() }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map { $0.count(of: CharacterSet.decimalDigits).filter { $0.isOdd }.count }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { $0.count(of: CharacterSet.decimalDigits).filter { $0.isOdd }.count }
}
```

return lst.map { $0.count(of: CharacterSet.decimalDigits).filter { $0.isOdd }.count } // cannot call value of non-function type 'Int'

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for i in 0..<lst.count {
        let count = lst[i].filter { $0 == "1" || $0 == "3" || $0 == "5" || $0 == "7" || $0 == "9" }.count
        result.append("the number of odd elements \(count) in the string \(i) of the input.")
    }
    return result
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for i in 0..<lst.count {
        let count = lst[i].filter { $0 == "1" || $0 == "3" || $0 == "5" || $0 == "7" || $0 == "9" }.count
        result.append("the number of odd elements \(count) in the string \(i) of the input.")
    }
    return result
}
```
 // XCTAssertTrue failed

func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}
```

let oddCount = str.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}

extension Character {
    func isOdd() -> Bool {
        return Int(String(self))! % 2 == 1
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { str in
        let oddCount = str.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(str) of the input."
    }
}

// Helper function to check if a character is odd
extension Character {
    func isOdd() -> Bool {
        return Int(String(self))! % 2 == 1
    }
}
```

 // XCTAssertTrue failed

func oddCount(lst: [String]) -> [String] {
    return lst.map { string in
        let oddCount = string.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(string) of the input."
    }
}

extension Character {
    func isOdd() -> Bool {
        return Int(String(self))! % 2 != 0
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { string in
        let oddCount = string.filter { $0.isOdd() }.count
        return "the number of odd elements \(oddCount) in the string \(string) of the input."
    }
}

// Helper function to check if a character is odd
extension Character {
    func isOdd() -> Bool {
        return Int(String(self))! % 2 != 0
    }
}
```

 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = 0
    for num in nums {
        currentSum = min(num, currentSum + num)
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    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 = nums[0]
    var currentSum = nums[0]
    for i in 1..<nums.count {
        currentSum = min(nums[i], currentSum + nums[i])
        minSum = min(minSum, currentSum)
    }
    return minSum
}
```

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for cell in row {
            totalWater += cell
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for cell in row {
            totalWater += cell
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```

 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for cell in row {
            totalWater += cell
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for cell in row {
            totalWater += cell
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```

 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```

 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity > 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity > 0 ? 1 : 0)
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var buckets = 0
    for row in grid {
        var water = 0
        for well in row {
            water += well
        }
        buckets += (water + capacity - 1) / capacity
    }
    return buckets
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var buckets = 0
    for row in grid {
        var water = 0
        for well in row {
            water += well
        }
        buckets += (water + capacity - 1) / capacity
    }
    return buckets
}
```

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var buckets = 0
    for row in grid {
        for well in row {
            if well == 1 {
                buckets += capacity
            }
        }
    }
    return buckets / capacity
}
```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 buckets = 0
    for row in grid {
        for well in row {
            if well == 1 {
                buckets += capacity
            }
        }
    }
    return buckets / capacity
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity > 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity > 0 ? 1 : 0)
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```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 totalWater = 0
    for row in grid {
        for well in row {
            totalWater += well
        }
    }
    return totalWater / capacity + (totalWater % capacity != 0 ? 1 : 0)
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonZeroBitCount
        let bOnes = b.nonZeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonZeroBitCount
        let bOnes = b.nonZeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```

let aOnes = a.nonZeroBitCount // value of type 'Int' has no member 'nonZeroBitCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```

 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonZeroBitCount
        let countB = b.nonZeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonZeroBitCount
        let countB = b.nonZeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```

let countA = a.nonZeroBitCount // value of type 'Int' has no member 'nonZeroBitCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonzeroBitCount
        let bOnes = b.nonzeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonzeroBitCount
        let bOnes = b.nonzeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonZeroBitCount
        let bOnes = b.nonZeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.nonZeroBitCount
        let bOnes = b.nonZeroBitCount
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```
let aOnes = a.nonZeroBitCount // value of type 'Int' has no member 'nonZeroBitCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let countA = a.nonzeroBitCount
        let countB = b.nonzeroBitCount
        if countA == countB {
            return a < b
        } else {
            return countA < countB
        }
    }
}
```
 // XCTAssertTrue failed

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

func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    return words.filter { word in
        let consonants = Array(word.filter { $0.isLetter && !["a", "e", "i", "o", "u"].contains($0.lowercased()) })
        return consonants.count == n
    }
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    return words.filter { word in
        let consonants = Array(word.filter { $0.isLetter && !["a", "e", "i", "o", "u"].contains($0.lowercased()) })
        return consonants.count == n
    }
}
```

func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    return words.filter { word in
        let consonants = Array(word.filter { $0.isLetter && !["a", "e", "i", "o", "u"].contains($0.lowercased()) })
        return consonants.count == n
    }
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    return words.filter { word in
        let consonants = Array(word.filter { $0.isLetter && !["a", "e", "i", "o", "u"].contains($0.lowercased()) })
        return consonants.count == n
    }
}
```

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

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

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

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

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

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

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

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var closestVowel = ""
    var closestVowelDistance = Int.max
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            let nextChar = word[word.index(word.startIndex, offsetBy: index + 1)]
            if vowels.contains(nextChar) {
                let distance = word.distance(from: word.index(word.startIndex, offsetBy: index), to: word.index(word.startIndex, offsetBy: index + 1))
                if distance < closestVowelDistance {
                    closestVowelDistance = distance
                    closestVowel = nextChar
                }
            }
        }
    }
    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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var closestVowel = ""
    var closestVowelDistance = Int.max
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            let nextChar = word[word.index(word.startIndex, offsetBy: index + 1)]
            if vowels.contains(nextChar) {
                let distance = word.distance(from: word.index(word.startIndex, offsetBy: index), to: word.index(word.startIndex, offsetBy: index + 1))
                if distance < closestVowelDistance {
                    closestVowelDistance = distance
                    closestVowel = nextChar
                }
            }
        }
    }
    return closestVowel
}
```
closestVowel = nextChar // cannot assign value of type 'Character' to type 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character = ""
    var closestVowelIndex = -1
    
    for i in 1..<wordArray.count - 1 {
        if consonants.contains(wordArray[i]) && vowels.contains(wordArray[i - 1]) && vowels.contains(wordArray[i + 1]) {
            let distance = abs(vowels.index(of: wordArray[i])! - vowels.index(of: wordArray[i - 1])!)
            if closestVowelIndex == -1 || distance < closestVowelIndex {
                closestVowelIndex = distance
                closestVowel = wordArray[i]
            }
        }
    }
    
    return String(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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character = ""
    var closestVowelIndex = -1
    
    for i in 1..<wordArray.count - 1 {
        if consonants.contains(wordArray[i]) && vowels.contains(wordArray[i - 1]) && vowels.contains(wordArray[i + 1]) {
            let distance = abs(vowels.index(of: wordArray[i])! - vowels.index(of: wordArray[i - 1])!)
            if closestVowelIndex == -1 || distance < closestVowelIndex {
                closestVowelIndex = distance
                closestVowel = wordArray[i]
            }
        }
    }
    
    return String(closestVowel)
}
```
var closestVowel: Character = "" // cannot convert value of type 'String' to specified type 'Character'
let distance = abs(vowels.index(of: wordArray[i])! - vowels.index(of: wordArray[i - 1])!) // referencing operator function '-' on 'Strideable' requires that 'String.Index' conform to '_Pointer'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                break
            }
        }
    }
    return result
}
```
 // Fatal error: String index is out of bounds

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character? = nil
    
    for i in stride(from: wordArray.count - 1, through: 1, by: -1) {
        if consonants.contains(wordArray[i]) {
            if vowels.contains(wordArray[i - 1]) {
                closestVowel = wordArray[i - 1]
                break
            }
        }
    }
    
    return closestVowel?.lowercased() ?? ""
}
```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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character? = nil
    
    for i in stride(from: wordArray.count - 1, through: 1, by: -1) {
        if consonants.contains(wordArray[i]) {
            if vowels.contains(wordArray[i - 1]) {
                closestVowel = wordArray[i - 1]
                break
            }
        }
    }
    
    return closestVowel?.lowercased() ?? ""
}
```

 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                break
            }
        }
    }
    return result
}
```
 // Fatal error: String index is out of bounds

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: String = ""
    var closestVowelIndex = -1
    for i in stride(from: wordArray.count - 1, through: 0, by: -1) {
        if consonants.contains(String(wordArray[i])) {
            if vowels.contains(String(wordArray[i])) {
                if closestVowelIndex == -1 {
                    closestVowelIndex = i
                } else {
                    if i - closestVowelIndex < closestVowelIndex - closestVowelIndex {
                        closestVowelIndex = i
                    }
                }
            }
        }
    }
    if closestVowelIndex != -1 {
        closestVowel = String(wordArray[closestVowelIndex])
    }
    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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: String = ""
    var closestVowelIndex = -1
    for i in stride(from: wordArray.count - 1, through: 0, by: -1) {
        if consonants.contains(String(wordArray[i])) {
            if vowels.contains(String(wordArray[i])) {
                if closestVowelIndex == -1 {
                    closestVowelIndex = i
                } else {
                    if i - closestVowelIndex < closestVowelIndex - closestVowelIndex {
                        closestVowelIndex = i
                    }
                }
            }
        }
    }
    if closestVowelIndex != -1 {
        closestVowel = String(wordArray[closestVowelIndex])
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                let distance = word.distance(from: word.index(word.startIndex, offsetBy: index + 1), to: word.index(word.startIndex, offsetBy: index))
                if distance < closestDistance {
                    closestDistance = distance
                    closestVowel = String(word[word.index(word.startIndex, offsetBy: index + 1)])
                }
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                let distance = word.distance(from: word.index(word.startIndex, offsetBy: index + 1), to: word.index(word.startIndex, offsetBy: index))
                if distance < closestDistance {
                    closestDistance = distance
                    closestVowel = String(word[word.index(word.startIndex, offsetBy: index + 1)])
                }
            }
        }
    }
    return closestVowel
}
```
 // Fatal error: String index is out of bounds

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character? = nil
    
    for i in stride(from: wordArray.count - 1, through: 1, by: -1) {
        let currentChar = wordArray[i]
        if consonants.contains(currentChar) {
            continue
        }
        if vowels.contains(currentChar) {
            if closestVowel == nil || vowels.index(of: currentChar)! < vowels.index(of: closestVowel!)! {
                closestVowel = currentChar
            }
        }
    }
    
    return closestVowel?.lowercased() ?? ""
}
```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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    let wordArray = Array(word)
    var closestVowel: Character? = nil
    
    for i in stride(from: wordArray.count - 1, through: 1, by: -1) {
        let currentChar = wordArray[i]
        if consonants.contains(currentChar) {
            continue
        }
        if vowels.contains(currentChar) {
            if closestVowel == nil || vowels.index(of: currentChar)! < vowels.index(of: closestVowel!)! {
                closestVowel = currentChar
            }
        }
    }
    
    return closestVowel?.lowercased() ?? ""
}
```
if closestVowel == nil || vowels.index(of: currentChar)! < vowels.index(of: closestVowel!)! { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
if closestVowel == nil || vowels.index(of: currentChar)! < vowels.index(of: closestVowel!)! { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                break
            }
        }
    }
    return result
}
```
 // Fatal error: String index is out of bounds

func getClosestVowel(word: String) -> String {
    let vowels = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                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 = "aeiouAEIOU"
    let consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
    var result = ""
    for (index, char) in word.enumerated().reversed() {
        if consonants.contains(char) {
            if vowels.contains(word[word.index(word.startIndex, offsetBy: index + 1)]) {
                result = String(char)
                break
            }
        }
    }
    return result
}
```
 // Fatal error: String index is out of bounds

func matchParens(lst: [String]) -> String {
    var count = 0
    for s in lst {
        for c in s {
            if c == "(" {
                count += 1
            } else if c == ")" {
                count -= 1
            }
        }
    }
    return count == 0 ? "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 count = 0
    for s in lst {
        for c in s {
            if c == "(" {
                count += 1
            } else if c == ")" {
                count -= 1
            }
        }
    }
    return count == 0 ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        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 open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        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 open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```

 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    let open = lst[0].filter { $0 == "(" }.count
    let close = lst[1].filter { $0 == ")" }.count
    if open == close {
        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 {
    let open = lst[0].filter { $0 == "(" }.count
    let close = lst[1].filter { $0 == ")" }.count
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```

 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else {
                close += 1
            }
        }
    }
    if open == close {
        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 open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else {
                close += 1
            }
        }
    }
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    let s1 = lst[0]
    let s2 = lst[1]
    var count = 0
    for c in s1 {
        if c == "(" {
            count += 1
        } else if c == ")" {
            count -= 1
        }
    }
    for c in s2 {
        if c == "(" {
            count += 1
        } else if c == ")" {
            count -= 1
        }
    }
    if count == 0 {
        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 {
    let s1 = lst[0]
    let s2 = lst[1]
    var count = 0
    for c in s1 {
        if c == "(" {
            count += 1
        } else if c == ")" {
            count -= 1
        }
    }
    for c in s2 {
        if c == "(" {
            count += 1
        } else if c == ")" {
            count -= 1
        }
    }
    if count == 0 {
        return "Yes"
    } else {
        return "No"
    }
}
```

 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var count = 0
    for s in lst {
        for c in s {
            if c == "(" {
                count += 1
            } else if c == ")" {
                count -= 1
            }
        }
    }
    return count == 0 ? "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 count = 0
    for s in lst {
        for c in s {
            if c == "(" {
                count += 1
            } else if c == ")" {
                count -= 1
            }
        }
    }
    return count == 0 ? "Yes" : "No"
}
```

 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    let open = lst[0].filter { $0 == "(" }.count
    let close = lst[1].filter { $0 == ")" }.count
    return open == close ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    let open = lst[0].filter { $0 == "(" }.count
    let close = lst[1].filter { $0 == ")" }.count
    return open == close ? "Yes" : "No"
}
```

 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        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 open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else if c == ")" {
                close += 1
            }
        }
    }
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else {
                close += 1
            }
        }
    }
    if open == close {
        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 open = 0
    var close = 0
    for s in lst {
        for c in s {
            if c == "(" {
                open += 1
            } else {
                close += 1
            }
        }
    }
    if open == close {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```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 num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<k {
        var maxIndex = i
        for j in i..<arr.count {
            if arr[j] > arr[maxIndex] {
                maxIndex = j
            }
        }
        result.append(arr[maxIndex])
        arr[maxIndex] = Int.min
    }
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<k {
        var maxIndex = i
        for j in i..<arr.count {
            if arr[j] > arr[maxIndex] {
                maxIndex = j
            }
        }
        result.append(arr[maxIndex])
        arr[maxIndex] = Int.min
    }
    return result
}
```
arr[maxIndex] = Int.min // cannot assign through subscript: 'arr' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```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 num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```

var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<k {
        var maxIndex = i
        for j in i..<arr.count {
            if arr[j] > arr[maxIndex] {
                maxIndex = j
            }
        }
        result.append(arr[maxIndex])
        arr[maxIndex] = Int.min
    }
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<k {
        var maxIndex = i
        for j in i..<arr.count {
            if arr[j] > arr[maxIndex] {
                maxIndex = j
            }
        }
        result.append(arr[maxIndex])
        arr[maxIndex] = Int.min
    }
    return result
}
```
arr[maxIndex] = Int.min // cannot assign through subscript: 'arr' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = Array(repeating: 0, count: k)
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    for i in 0..<k {
        result[i] = 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 = Array(repeating: 0, count: k)
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    for i in 0..<k {
        result[i] = maxHeap.remove()!
    }
    return result
}
```

var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.elements
}
```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 num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.elements
}
```

var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```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 num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```

var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = Array(repeating: 0, count: k)
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    for _ in 0..<k {
        result[result.count - 1 - _] = 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 = Array(repeating: 0, count: k)
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    for _ in 0..<k {
        result[result.count - 1 - _] = maxHeap.remove()!
    }
    return result
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope
result[result.count - 1 - _] = maxHeap.remove()! // '_' can only appear in a pattern or on the left side of an assignment

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```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 num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    return maxHeap.toArray()
}
```

var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

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

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers, 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 }.map { $0.element }.reduce(0, +)
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers, 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 }.map { $0.element }.reduce(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
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers, 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 }.map { $0.element }.reduce(0, +)
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers, 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 }.map { $0.element }.reduce(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
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers, 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 }.map { $0.element }.reduce(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
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<min(k, arr.count) {
        if arr[i] < 100 {
            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..<min(k, arr.count) {
        if arr[i] < 100 {
            sum += arr[i]
        }
    }
    return sum
}
```

func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = collatz(current)
    }
    result.append(1)
    return result.sorted()
}

func collatz(n: Int) -> Int {
    if n % 2 == 0 {
        return n / 2
    } else {
        return 3 * n + 1
    }
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = collatz(current)
    }
    result.append(1)
    return result.sorted()
}

func collatz(n: Int) -> Int {
    if n % 2 == 0 {
        return n / 2
    } else {
        return 3 * n + 1
    }
}
```

current = collatz(current) // missing argument label 'n:' in call

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            sequence.append(current)
        }
        current = collatz(current)
    }
    sequence.append(1)
    return sequence.sorted()
}

func collatz(n: Int) -> Int {
    if n % 2 == 0 {
        return n / 2
    } else {
        return 3 * n + 1
    }
}
```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 sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            sequence.append(current)
        }
        current = collatz(current)
    }
    sequence.append(1)
    return sequence.sorted()
}

func collatz(n: Int) -> Int {
    if n % 2 == 0 {
        return n / 2
    } else {
        return 3 * n + 1
    }
}
```

current = collatz(current) // missing argument label 'n:' in call

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.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 sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.filter { $0 % 2 != 0 }
}
```

 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.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 sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.filter { $0 % 2 != 0 }
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            sequence.append(current)
        }
        current = current / 2
    }
    sequence.append(1)
    return sequence
}
```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 sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            sequence.append(current)
        }
        current = current / 2
    }
    sequence.append(1)
    return sequence
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current / 2
    }
    result.append(1)
    return result
}
```

 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [n]
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.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 sequence = [n]
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.filter { $0 % 2 != 0 }
}
```

 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.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 sequence = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        sequence.append(current)
    }
    return sequence.filter { $0 % 2 != 0 }
}
```
 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    // Your code here
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    // Your code here
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        
        if year < 1900 || year > 2099 {
            return false
        }
        
        if month < 1 || month > 12 {
            return false
        }
        
        if day < 1 || day > 31 {
            return false
        }
        
        if month == 2 && day > 29 {
            return false
        }
        
        if month == 4 || month == 6 || month == 9 || month == 11 && day > 30 {
            return false
        }
        
        return true
    } else {
        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"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        
        if year < 1900 || year > 2099 {
            return false
        }
        
        if month < 1 || month > 12 {
            return false
        }
        
        if day < 1 || day > 31 {
            return false
        }
        
        if month == 2 && day > 29 {
            return false
        }
        
        if month == 4 || month == 6 || month == 9 || month == 11 && day > 30 {
            return false
        }
        
        return true
    } else {
        return false
    }
}
```

 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        if year >= 1900 && year <= 2099 && month >= 1 && month <= 12 && day >= 1 && day <= 31 {
            if month == 2 && day > 29 {
                return false
            }
            if month == 4 || month == 6 || month == 9 || month == 11 && day > 30 {
                return false
            }
            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"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        if year >= 1900 && year <= 2099 && month >= 1 && month <= 12 && day >= 1 && day <= 31 {
            if month == 2 && day > 29 {
                return false
            }
            if month == 4 || month == 6 || month == 9 || month == 11 && day > 30 {
                return false
            }
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    // Split the date string into its components
    let components = date.components(separatedBy: "-")
    
    // Check if the date string is empty
    guard components.count == 3 else { return false }
    
    // Check if the month, day, and year are valid
    let month = Int(components[0]) ?? 0
    let day = Int(components[1]) ?? 0
    let year = Int(components[2]) ?? 0
    
    // Check if the month is valid
    guard month >= 1 && month <= 12 else { return false }
    
    // Check if the day is valid
    if month == 2 {
        // Check if the year is a leap year
        let isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)
        guard day >= 1 && day <= (isLeapYear ? 29 : 28) else { return false }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        guard day >= 1 && day <= 30 else { return false }
    } else {
        guard day >= 1 && day <= 31 else { return false }
    }
    
    // Check if the year is valid
    guard year >= 1 else { return false }
    
    // If all checks pass, the date is valid
    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 {
    // Split the date string into its components
    let components = date.components(separatedBy: "-")
    
    // Check if the date string is empty
    guard components.count == 3 else { return false }
    
    // Check if the month, day, and year are valid
    let month = Int(components[0]) ?? 0
    let day = Int(components[1]) ?? 0
    let year = Int(components[2]) ?? 0
    
    // Check if the month is valid
    guard month >= 1 && month <= 12 else { return false }
    
    // Check if the day is valid
    if month == 2 {
        // Check if the year is a leap year
        let isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)
        guard day >= 1 && day <= (isLeapYear ? 29 : 28) else { return false }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        guard day >= 1 && day <= 30 else { return false }
    } else {
        guard day >= 1 && day <= 31 else { return false }
    }
    
    // Check if the year is valid
    guard year >= 1 else { return false }
    
    // If all checks pass, the date is valid
    return true
}
```

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    if let date = dateFormatter.date(from: date) {
        let components = Calendar.current.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        if year >= 1900 && year <= 2099 {
            if month >= 1 && month <= 12 {
                if day >= 1 && day <= 31 {
                    if month == 2 {
                        if year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) {
                            if day <= 29 {
                                return true
                            } else {
                                return false
                            }
                        } else {
                            if day <= 28 {
                                return true
                            } else {
                                return false
                            }
                        }
                    } else if month == 4 || month == 6 || month == 9 || month == 11 {
                        if day <= 30 {
                            return true
                        } else {
                            return false
                        }
                    } else {
                        if day <= 31 {
                            return true
                        } else {
                            return false
                        }
                    }
                } else {
                    return false
                }
            } else {
                return false
            }
        } else {
            return false
        }
    } else {
        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"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    if let date = dateFormatter.date(from: date) {
        let components = Calendar.current.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        if year >= 1900 && year <= 2099 {
            if month >= 1 && month <= 12 {
                if day >= 1 && day <= 31 {
                    if month == 2 {
                        if year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) {
                            if day <= 29 {
                                return true
                            } else {
                                return false
                            }
                        } else {
                            if day <= 28 {
                                return true
                            } else {
                                return false
                            }
                        }
                    } else if month == 4 || month == 6 || month == 9 || month == 11 {
                        if day <= 30 {
                            return true
                        } else {
                            return false
                        }
                    } else {
                        if day <= 31 {
                            return true
                        } else {
                            return false
                        }
                    }
                } else {
                    return false
                }
            } else {
                return false
            }
        } else {
            return false
        }
    } else {
        return false
    }
}
```

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    if let date = 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 date = dateFormatter.date(from: date) {
        return true
    }
    return false
}
```

if let date = dateFormatter.date(from: date) { // value 'date' was defined but never used; consider replacing with boolean test

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    if let date = dateFormatter.date(from: date) {
        return true
    } else {
        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 date = dateFormatter.date(from: date) {
        return true
    } else {
        return false
    }
}
```

if let date = dateFormatter.date(from: date) { // value 'date' was defined but never used; consider replacing with boolean test

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    if let date = dateFormatter.date(from: date) {
        return true
    } else {
        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 date = dateFormatter.date(from: date) {
        return true
    } else {
        return false
    }
}
```

if let date = dateFormatter.date(from: date) { // value 'date' was defined but never used; consider replacing with boolean test

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        
        if year < 1900 || year > 2099 {
            return false
        }
        
        if month < 1 || month > 12 {
            return false
        }
        
        if day < 1 || day > 31 {
            return false
        }
        
        if month == 2 {
            if year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) {
                if day > 29 {
                    return false
                }
            } else {
                if day > 28 {
                    return false
                }
            }
        } else if month == 4 || month == 6 || month == 9 || month == 11 {
            if day > 30 {
                return false
            }
        }
        
        return true
    } else {
        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"
    dateFormatter.locale = Locale(identifier: "en_US_POSIX")
    
    if let date = dateFormatter.date(from: date) {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.year, .month, .day], from: date)
        let year = components.year ?? 0
        let month = components.month ?? 0
        let day = components.day ?? 0
        
        if year < 1900 || year > 2099 {
            return false
        }
        
        if month < 1 || month > 12 {
            return false
        }
        
        if day < 1 || day > 31 {
            return false
        }
        
        if month == 2 {
            if year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) {
                if day > 29 {
                    return false
                }
            } else {
                if day > 28 {
                    return false
                }
            }
        } else if month == 4 || month == 6 || month == 9 || month == 11 {
            if day > 30 {
                return false
            }
        }
        
        return true
    } else {
        return false
    }
}
```

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```swift
extension Int: Error {

}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```

if let words = txt.components(separatedBy: .whitespacesAndNewlines) { // initializer for conditional binding must have Optional type, not '[String]'
} else if let words = txt.components(separatedBy: ",") { // initializer for conditional binding must have Optional type, not '[String]'
let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count // value of type 'String.Element' (aka 'Character') has no member 'isLowercased'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    // Your implementation here
}
```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> {
    // Your implementation here
}
```

} // missing return in global function expected to return 'Result<[String], Int>'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.split(separator: " ").map(String.init) {
        return .success(words)
    } else if let words = txt.split(separator: ",").map(String.init) {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.asciiValue! >= 97 && $1.asciiValue! <= 122 ? 1 : 0) }
        return .failure(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> {
    if let words = txt.split(separator: " ").map(String.init) {
        return .success(words)
    } else if let words = txt.split(separator: ",").map(String.init) {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.asciiValue! >= 97 && $1.asciiValue! <= 122 ? 1 : 0) }
        return .failure(count)
    }
}
```

if let words = txt.split(separator: " ").map(String.init) { // initializer for conditional binding must have Optional type, not '[String]'
} else if let words = txt.split(separator: ",").map(String.init) { // initializer for conditional binding must have Optional type, not '[String]'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    // Your implementation here
}
```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> {
    // Your implementation here
}
```

} // missing return in global function expected to return 'Result<[String], Int>'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercase && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```swift
extension Int: Error {

}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercase && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```

if let words = txt.components(separatedBy: .whitespacesAndNewlines) { // initializer for conditional binding must have Optional type, not '[String]'
} else if let words = txt.components(separatedBy: ",") { // initializer for conditional binding must have Optional type, not '[String]'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    // Your implementation here
}
```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> {
    // Your implementation here
}
```

} // missing return in global function expected to return 'Result<[String], Int>'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```swift
extension Int: Error {

}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count
        return .failure(oddCount)
    }
}
```

if let words = txt.components(separatedBy: .whitespacesAndNewlines) { // initializer for conditional binding must have Optional type, not '[String]'
} else if let words = txt.components(separatedBy: ",") { // initializer for conditional binding must have Optional type, not '[String]'
let oddCount = txt.filter { $0.isLowercased() && $0.unicodeScalars.first!.value % 2 != 0 }.count // value of type 'String.Element' (aka 'Character') has no member 'isLowercased'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    var result: [String] = []
    var oddCount = 0
    for char in txt {
        if let asciiValue = char.unicodeScalars.first?.value {
            if asciiValue >= 97 && asciiValue <= 122 {
                if (asciiValue - 97) % 2 == 1 {
                    oddCount += 1
                }
            } else if char == " " {
                result.append(String(char))
            } else if char == "," {
                result.append(String(char))
            }
        }
    }
    if oddCount > 0 {
        return .failure(oddCount)
    } else {
        return .success(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> {
    var result: [String] = []
    var oddCount = 0
    for char in txt {
        if let asciiValue = char.unicodeScalars.first?.value {
            if asciiValue >= 97 && asciiValue <= 122 {
                if (asciiValue - 97) % 2 == 1 {
                    oddCount += 1
                }
            } else if char == " " {
                result.append(String(char))
            } else if char == "," {
                result.append(String(char))
            }
        }
    }
    if oddCount > 0 {
        return .failure(oddCount)
    } else {
        return .success(result)
    }
}
```

 // XCTAssertTrue failed

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 }
        return .failure(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> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 }
        return .failure(count)
    }
}
```

if let words = txt.components(separatedBy: .whitespacesAndNewlines) { // initializer for conditional binding must have Optional type, not '[String]'
} else if let words = txt.components(separatedBy: ",") { // initializer for conditional binding must have Optional type, not '[String]'
let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 } // type 'UInt8' cannot be used as a boolean; test for '!= 0' instead
let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 } // cannot convert value of type 'Bool' to expected argument type 'Int'

extension Int: Error {

}

func splitWords(txt: String) -> Result<[String], Int> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 == 1 ? 1 : 0 }
        return .failure(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> {
    if let words = txt.components(separatedBy: .whitespacesAndNewlines) {
        return .success(words)
    } else if let words = txt.components(separatedBy: ",") {
        return .success(words)
    } else {
        let count = txt.reduce(0) { $0 + ($1.isLowercase && $1.asciiValue! - 97) % 2 == 1 ? 1 : 0 }
        return .failure(count)
    }
}
```

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 {
    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
        }
    }
    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 {
    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
        }
    }
    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
        }
    }
    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
        }
    }
    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
        }
    }
    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 start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let intersectionLength = end - start + 1
    if intersectionLength <= 0 {
        return "NO"
    }
    if isPrime(number: intersectionLength) {
        return "YES"
    }
    return "NO"
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<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 {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let intersectionLength = end - start + 1
    if intersectionLength <= 0 {
        return "NO"
    }
    if isPrime(number: intersectionLength) {
        return "YES"
    }
    return "NO"
}

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

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "YES"
    }
    if length == 2 {
        return "YES"
    }
    if length == 3 {
        return "YES"
    }
    if length == 4 {
        return "YES"
    }
    if length == 5 {
        return "YES"
    }
    if length == 6 {
        return "YES"
    }
    if length == 7 {
        return "YES"
    }
    if length == 8 {
        return "YES"
    }
    if length == 9 {
        return "YES"
    }
    if length == 10 {
        return "YES"
    }
    if length == 11 {
        return "YES"
    }
    if length == 12 {
        return "YES"
    }
    if length == 13 {
        return "YES"
    }
    if length == 14 {
        return "YES"
    }
    if length == 15 {
        return "YES"
    }
    if length == 16 {
        return "YES"
    }
    if length == 17 {
        return "YES"
    }
    if length == 18 {
        return "YES"
    }
    if length == 19 {
        return "YES"
    }
    if length == 20 {
        return "YES"
    }
    if length == 21 {
        return "YES"
    }
    if length == 22 {
        return "YES"
    }
    if length == 23 {
        return "YES"
    }
    if length == 24 {
        return "YES"
    }
    if length == 25 {
        return "YES"
    }
    if length == 26 {
        return "YES"
    }
    if length == 27 {
        return "YES"
    }
    if length == 28 {
        return "YES"
    }
    if length == 29 {
        return "YES"
    }
    if length == 30 {
        return "YES"
    }
    if length == 31 {
        return "YES"
    }
    if length == 32 {
        return "YES"
    }
    if length == 33 {
        return "YES"
    }
    if length == 34 {
        return "YES"
    }
    if length == 35 {
        return "YES"
    }
    if length == 36 {
        return "YES"
    }
    if length == 37 {
        return "YES"
    }
    if length == 38 {
        return "YES"
    }
    if length == 39 {
        return "YES"
    }
    if length == 40 {
        return "YES"
    }
    if length == 41 {
        return "YES"
    }
    if length == 42 {
        return "YES"
    }
    if length == 43 {
        return "YES"
    }
    if length == 44 {
        return "YES"
    }
    if length == 45 {
        return "YES"
    }
    if length == 46 {
        return "YES"
    }
    if length == 47 {
        return "YES"
    }
    if length == 48 {
        return "YES"
    }
    if length == 49 {
        return "YES"
    }
    if length == 50 {
        return "YES"
    }
    if length == 51 {
        return "YES"
    }
    if length == 52 {
        return "YES"
    }
    if length == 53 {
        return "YES"
    }
    if length == 54 {
        return "YES"
    }
    if length == 55 {
        return "YES"
    }
    if length == 56 {
        return "YES"
    }
    if length == 57 {
        return "YES"
    }
    if length == 58 {
        return "YES"
    }
    if length == 59 {
        return "YES"
    }
    if length == 60 {
        return "YES"
    }
    if length == 61 {
        return "YES"
    }
    if length == 62 {
        return "YES"
    }
    if length == 63 {
        return "YES"
    }
    if length == 64 {
        return "YES"
    }
    if length == 65 {
        return "YES"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let intersectionLength = end - start
    if intersectionLength <= 0 {
        return "NO"
    }
    if intersectionLength == 1 {
        return "NO"
    }
    if intersectionLength == 2 {
        return "NO"
    }
    if intersectionLength == 3 {
        return "NO"
    }
    if intersectionLength == 4 {
        return "NO"
    }
    if intersectionLength == 5 {
        return "NO"
    }
    if intersectionLength == 6 {
        return "NO"
    }
    if intersectionLength == 7 {
        return "NO"
    }
    if intersectionLength == 8 {
        return "NO"
    }
    if intersectionLength == 9 {
        return "NO"
    }
    if intersectionLength == 10 {
        return "NO"
    }
    if intersectionLength == 11 {
        return "NO"
    }
    if intersectionLength == 12 {
        return "NO"
    }
    if intersectionLength == 13 {
        return "NO"
    }
    if intersectionLength == 14 {
        return "NO"
    }
    if intersectionLength == 15 {
        return "NO"
    }
    if intersectionLength == 16 {
        return "NO"
    }
    if intersectionLength == 17 {
        return "NO"
    }
    if intersectionLength == 18 {
        return "NO"
    }
    if intersectionLength == 19 {
        return "NO"
    }
    if intersectionLength == 20 {
        return "NO"
    }
    if intersectionLength == 21 {
        return "NO"
    }
    if intersectionLength == 22 {
        return "NO"
    }
    if intersectionLength == 23 {
        return "NO"
    }
    if intersectionLength == 24 {
        return "NO"
    }
    if intersectionLength == 25 {
        return "NO"
    }
    if intersectionLength == 26 {
        return "NO"
    }
    if intersectionLength == 27 {
        return "NO"
    }
    if intersectionLength == 28 {
        return "NO"
    }
    if intersectionLength == 29 {
        return "NO"
    }
    if intersectionLength == 30 {
        return "NO"
    }
    if intersectionLength == 31 {
        return "NO"
    }
    if intersectionLength == 32 {
        return "NO"
    }
    if intersectionLength == 33 {
        return "NO"
    }
    if intersectionLength == 34 {
        return "NO"
    }
    if intersectionLength == 35 {
        return "NO"
    }
    if intersectionLength == 36 {
        return "NO"
    }
    if intersectionLength == 37 {
        return "NO"
    }
    if intersectionLength == 38 {
        return "NO"
    }
    if intersectionLength == 39 {
        return "NO"
    }
    if intersectionLength == 40 {
        return "NO"
    }
    if intersectionLength == 41 {
        return "NO"
    }
    if intersectionLength == 42 {
        return "NO"
    }
    if intersectionLength == 43 {
        return "NO"
    }
    if intersectionLength == 44 {
        return "NO"
    }
    if intersectionLength == 45 {
        return "NO"
    }
    if intersectionLength == 46 {
        return "NO"
    }
    if intersectionLength == 47 {
        return "NO"
    }
    if intersectionLength == 48 {
        return "NO"
    }
    if intersectionLength == 49 {
        return "NO"
    }
    if intersectionLength == 50 {
        return "NO"
    }
    if intersectionLength == 51 {
        return "NO"
    }
    if intersectionLength == 52 {
        return "NO"
    }
    if intersectionLength == 53 {
        return "NO"
    }
    if intersectionLength == 54 {
        return "NO"
    }
    if intersectionLength == 55 {
        return "NO"
    }
    if intersectionLength == 56 {
        return "NO"
    }
    if intersectionLength == 57 {
        return "NO"
    }
    if intersectionLength == 58 {
        return "NO"
    }
    if intersectionLength == 59 {
        return "NO"
    }
    if intersectionLength == 60 {
        return "NO"
    }
    if intersectionLength == 61 {
        return "NO"
    }
    if
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "NO"
    }
    if length == 3 {
        return "NO"
    }
    if length == 4 {
        return "NO"
    }
    if length == 5 {
        return "NO"
    }
    if length == 6 {
        return "NO"
    }
    if length == 7 {
        return "NO"
    }
    if length == 8 {
        return "NO"
    }
    if length == 9 {
        return "NO"
    }
    if length == 10 {
        return "NO"
    }
    if length == 11 {
        return "NO"
    }
    if length == 12 {
        return "NO"
    }
    if length == 13 {
        return "NO"
    }
    if length == 14 {
        return "NO"
    }
    if length == 15 {
        return "NO"
    }
    if length == 16 {
        return "NO"
    }
    if length == 17 {
        return "NO"
    }
    if length == 18 {
        return "NO"
    }
    if length == 19 {
        return "NO"
    }
    if length == 20 {
        return "NO"
    }
    if length == 21 {
        return "NO"
    }
    if length == 22 {
        return "NO"
    }
    if length == 23 {
        return "NO"
    }
    if length == 24 {
        return "NO"
    }
    if length == 25 {
        return "NO"
    }
    if length == 26 {
        return "NO"
    }
    if length == 27 {
        return "NO"
    }
    if length == 28 {
        return "NO"
    }
    if length == 29 {
        return "NO"
    }
    if length == 30 {
        return "NO"
    }
    if length == 31 {
        return "NO"
    }
    if length == 32 {
        return "NO"
    }
    if length == 33 {
        return "NO"
    }
    if length == 34 {
        return "NO"
    }
    if length == 35 {
        return "NO"
    }
    if length == 36 {
        return "NO"
    }
    if length == 37 {
        return "NO"
    }
    if length == 38 {
        return "NO"
    }
    if length == 39 {
        return "NO"
    }
    if length == 40 {
        return "NO"
    }
    if length == 41 {
        return "NO"
    }
    if length == 42 {
        return "NO"
    }
    if length == 43 {
        return "NO"
    }
    if length == 44 {
        return "NO"
    }
    if length == 45 {
        return "NO"
    }
    if length == 46 {
        return "NO"
    }
    if length == 47 {
        return "NO"
    }
    if length == 48 {
        return "NO"
    }
    if length == 49 {
        return "NO"
    }
    if length == 50 {
        return "NO"
    }
    if length == 51 {
        return "NO"
    }
    if length == 52 {
        return "NO"
    }
    if length == 53 {
        return "NO"
    }
    if length == 54 {
        return "NO"
    }
    if length == 55 {
        return "NO"
    }
    if length == 56 {
        return "NO"
    }
    if length == 57 {
        return "NO"
    }
    if length == 58 {
        return "NO"
    }
    if length == 59 {
        return "NO"
    }
    if length == 60 {
        return "NO"
    }
    if length == 61 {
        return "NO"
    }
    if length == 62 {
        return "NO"
    }
    if length == 63 {
        return "NO"
    }
    if length == 64 {
        return "NO"
    }
    if length == 65 {
        return "NO"
    }
    if length == 
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO") // cannot find 'intersection' in scope
XCTAssertTrue(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO") // cannot find 'intersection' in scope

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    let product = arr.reduce(1, { $0 * $1 })
    let sign = product > 0 ? 1 : product < 0 ? -1 : 0
    return arr.map { $0 * sign }.reduce(0, +)
}
```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 }
    let product = arr.reduce(1, { $0 * $1 })
    let sign = product > 0 ? 1 : product < 0 ? -1 : 0
    return arr.map { $0 * sign }.reduce(0, +)
}
```

 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```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 sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```

func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty { return nil }
    let signProduct = arr.reduce(1, { $0 * ($1 > 0 ? 1 : ($1 < 0 ? -1 : 0)) })
    let magnitudeSum = arr.reduce(0, { $0 + abs($1) })
    return magnitudeSum * signProduct
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty { return nil }
    let signProduct = arr.reduce(1, { $0 * ($1 > 0 ? 1 : ($1 < 0 ? -1 : 0)) })
    let magnitudeSum = arr.reduce(0, { $0 + abs($1) })
    return magnitudeSum * signProduct
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        if num == 0 {
            product = 0
            break
        }
        product *= num < 0 ? -1 : 1
        sum += abs(num)
    }
    return product * sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        if num == 0 {
            product = 0
            break
        }
        product *= num < 0 ? -1 : 1
        sum += abs(num)
    }
    return product * sum
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= num > 0 ? 1 : num < 0 ? -1 : 0
        sum += abs(num)
    }
    return product * sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= num > 0 ? 1 : num < 0 ? -1 : 0
        sum += abs(num)
    }
    return product * sum
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```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 sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    let product = arr.reduce(1, { $0 * $1 })
    let sum = arr.map { $0 * abs($0) }.reduce(0, +)
    return product * sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    let product = arr.reduce(1, { $0 * $1 })
    let sum = arr.map { $0 * abs($0) }.reduce(0, +)
    return product * sum
}
```

 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    let product = arr.reduce(1, { $0 * $1 })
    let sum = arr.reduce(0, { $0 + abs($1) })
    return product * sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    let product = arr.reduce(1, { $0 * $1 })
    let sum = arr.reduce(0, { $0 + abs($1) })
    return product * sum
}
```

 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```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 sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return product * sum
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var product = 1
    var sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return sum * product
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```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 sum = 0
    for num in arr {
        product *= signum(num)
        sum += abs(num)
    }
    return sum * product
}

func signum(_ num: Int) -> Int {
    if num > 0 { return 1 }
    if num < 0 { return -1 }
    return 0
}
```

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: m), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPathValues = [Int]()
    
    func dfs(row: Int, col: Int, steps: Int) {
        if steps == k {
            if path.count < minPathLength {
                minPathLength = path.count
                minPathValues = path
            } else if path.count == minPathLength {
                if path < minPathValues {
                    minPathValues = path
                }
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= m || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        dfs(row: row + 1, col: col, steps: steps + 1)
        dfs(row: row - 1, col: col, steps: steps + 1)
        dfs(row: row, col: col + 1, steps: steps + 1)
        dfs(row: row, col: col - 1, steps: steps + 1)
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<m {
            visited = Array(repeating: Array(repeating: false, count: m), count: n)
            path = [Int]()
            dfs(row: i, col: j, steps: 0)
        }
    }
    
    return minPathValues
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: m), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPathValues = [Int]()
    
    func dfs(row: Int, col: Int, steps: Int) {
        if steps == k {
            if path.count < minPathLength {
                minPathLength = path.count
                minPathValues = path
            } else if path.count == minPathLength {
                if path < minPathValues {
                    minPathValues = path
                }
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= m || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        dfs(row: row + 1, col: col, steps: steps + 1)
        dfs(row: row - 1, col: col, steps: steps + 1)
        dfs(row: row, col: col + 1, steps: steps + 1)
        dfs(row: row, col: col - 1, steps: steps + 1)
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<m {
            visited = Array(repeating: Array(repeating: false, count: m), count: n)
            path = [Int]()
            dfs(row: i, col: j, steps: 0)
        }
    }
    
    return minPathValues
}
```
if path < minPathValues { // binary operator '<' cannot be applied to two '[Int]' operands

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPathValue = Int.max
    var pathLength = 0
    var pathValue = 0
    var queue = [(Int, Int, Int, [Int])]()

    func isSafe(row: Int, col: Int) -> Bool {
        return row >= 0 && row < n && col >= 0 && col < n && !visited[row][col]
    }

    func dfs(row: Int, col: Int, pathLength: Int, pathValue: Int) {
        if pathLength == k {
            if pathValue < minPathValue {
                minPath = path
                minPathValue = pathValue
                minPathLength = pathLength
            } else if pathValue == minPathValue && pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            }
            return
        }

        visited[row][col] = true
        path.append(grid[row][col])
        pathValue += grid[row][col]

        for i in -1...1 {
            for j in -1...1 {
                if i == 0 && j == 0 {
                    continue
                }
                let newRow = row + i
                let newCol = col + j
                if isSafe(row: newRow, col: newCol) {
                    dfs(row: newRow, col: newCol, pathLength: pathLength + 1, pathValue: pathValue)
                }
            }
        }

        visited[row][col] = false
        path.removeLast()
        pathValue -= grid[row][col]
    }

    for i in 0..<n {
        for j in 0..<n {
            dfs(row: i, col: j, pathLength: 0, pathValue: 0)
        }
    }

    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] {
    let n = grid.count
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPathValue = Int.max
    var pathLength = 0
    var pathValue = 0
    var queue = [(Int, Int, Int, [Int])]()

    func isSafe(row: Int, col: Int) -> Bool {
        return row >= 0 && row < n && col >= 0 && col < n && !visited[row][col]
    }

    func dfs(row: Int, col: Int, pathLength: Int, pathValue: Int) {
        if pathLength == k {
            if pathValue < minPathValue {
                minPath = path
                minPathValue = pathValue
                minPathLength = pathLength
            } else if pathValue == minPathValue && pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            }
            return
        }

        visited[row][col] = true
        path.append(grid[row][col])
        pathValue += grid[row][col]

        for i in -1...1 {
            for j in -1...1 {
                if i == 0 && j == 0 {
                    continue
                }
                let newRow = row + i
                let newCol = col + j
                if isSafe(row: newRow, col: newCol) {
                    dfs(row: newRow, col: newCol, pathLength: pathLength + 1, pathValue: pathValue)
                }
            }
        }

        visited[row][col] = false
        path.removeLast()
        pathValue -= grid[row][col]
    }

    for i in 0..<n {
        for j in 0..<n {
            dfs(row: i, col: j, pathLength: 0, pathValue: 0)
        }
    }

    return minPath
}
```
pathValue += grid[row][col] // left side of mutating operator isn't mutable: 'pathValue' is a 'let' constant
pathValue -= grid[row][col] // left side of mutating operator isn't mutable: 'pathValue' is a 'let' constant

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var minPath = [Int]()
    var path = [Int]()
    var visited = Set<[Int]>()
    var queue = [(Int, [Int])]()

    func dfs(row: Int, col: Int, steps: Int) {
        if steps == k {
            if minPath.isEmpty || path < minPath {
                minPath = path
            }
            return
        }
        let directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        for (dr, dc) in directions {
            let newRow = row + dr
            let newCol = col + dc
            if newRow >= 0 && newRow < n && newCol >= 0 && newCol < n {
                let newCell = [newRow, newCol]
                if !visited.contains(newCell) {
                    visited.insert(newCell)
                    path.append(grid[newRow][newCol])
                    dfs(row: newRow, col: newCol, steps: steps + 1)
                    path.removeLast()
                    visited.remove(newCell)
                }
            }
        }
    }

    for i in 0..<n {
        for j in 0..<n {
            visited.insert([i, j])
            path.append(grid[i][j])
            dfs(row: i, col: j, steps: 1)
            path.removeLast()
            visited.remove([i, j])
        }
    }

    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var minPath = [Int]()
    var path = [Int]()
    var visited = Set<[Int]>()
    var queue = [(Int, [Int])]()

    func dfs(row: Int, col: Int, steps: Int) {
        if steps == k {
            if minPath.isEmpty || path < minPath {
                minPath = path
            }
            return
        }
        let directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        for (dr, dc) in directions {
            let newRow = row + dr
            let newCol = col + dc
            if newRow >= 0 && newRow < n && newCol >= 0 && newCol < n {
                let newCell = [newRow, newCol]
                if !visited.contains(newCell) {
                    visited.insert(newCell)
                    path.append(grid[newRow][newCol])
                    dfs(row: newRow, col: newCol, steps: steps + 1)
                    path.removeLast()
                    visited.remove(newCell)
                }
            }
        }
    }

    for i in 0..<n {
        for j in 0..<n {
            visited.insert([i, j])
            path.append(grid[i][j])
            dfs(row: i, col: j, steps: 1)
            path.removeLast()
            visited.remove([i, j])
        }
    }

    return minPath
}
```
if minPath.isEmpty || path < minPath { // binary operator '<' cannot be applied to two '[Int]' operands

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var minPath = [Int]()
    var minPathLength = Int.max
    var path = [Int]()
    var pathLength = 0
    var queue = [(Int, Int, [Int])]()

    for i in 0..<n {
        for j in 0..<n {
            queue.append((i, j, [grid[i][j]]))
            visited[i][j] = true
        }
    }

    while !queue.isEmpty {
        let (i, j, path) = queue.removeFirst()
        pathLength = path.count

        if pathLength == k {
            if pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            } else if pathLength == minPathLength {
                if path < minPath {
                    minPath = path
                }
            }
        } else {
            let neighbors = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
            for (ni, nj) in neighbors {
                if ni >= 0 && ni < n && nj >= 0 && nj < n && !visited[ni][nj] {
                    visited[ni][nj] = true
                    queue.append((ni, nj, path + [grid[ni][nj]]))
                    visited[ni][nj] = false
                }
            }
        }
    }

    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] {
    let n = grid.count
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var minPath = [Int]()
    var minPathLength = Int.max
    var path = [Int]()
    var pathLength = 0
    var queue = [(Int, Int, [Int])]()

    for i in 0..<n {
        for j in 0..<n {
            queue.append((i, j, [grid[i][j]]))
            visited[i][j] = true
        }
    }

    while !queue.isEmpty {
        let (i, j, path) = queue.removeFirst()
        pathLength = path.count

        if pathLength == k {
            if pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            } else if pathLength == minPathLength {
                if path < minPath {
                    minPath = path
                }
            }
        } else {
            let neighbors = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
            for (ni, nj) in neighbors {
                if ni >= 0 && ni < n && nj >= 0 && nj < n && !visited[ni][nj] {
                    visited[ni][nj] = true
                    queue.append((ni, nj, path + [grid[ni][nj]]))
                    visited[ni][nj] = false
                }
            }
        }
    }

    return minPath
}
```

if path < minPath { // binary operator '<' cannot be applied to two '[Int]' operands

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: Int.max, count: k + 1), count: n * m)
    var path = Array(repeating: Array(repeating: 0, count: k + 1), count: n * m)
    var result = Array(repeating: 0, count: k)
    var minPath = Int.max
    var minPathIndex = 0
    var visited = Array(repeating: Array(repeating: false, count: n * m), count: n * m)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0] = true
    while !queue.isEmpty {
        let (x, y, steps) = queue.removeFirst()
        if steps == k {
            if dp[x][y] > steps {
                dp[x][y] = steps
                path[x][y] = steps
            }
            if dp[x][y] < minPath {
                minPath = dp[x][y]
                minPathIndex = x * m + y
            }
        } else {
            for (dx, dy) in [(1, 0), (-1, 0), (0, 1), (0, -1)] {
                let nx = x + dx
                let ny = y + dy
                if nx >= 0 && nx < n && ny >= 0 && ny < m && !visited[nx * m + ny] {
                    visited[nx * m + ny] = true
                    queue.append((nx, ny, steps + 1))
                    visited[nx * m + ny] = false
                }
            }
        }
    }
    var index = minPathIndex
    for i in 0..<k {
        result[k - i - 1] = grid[index / m][index % m]
        index = path[index / m][index % m]
    }
    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] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: Int.max, count: k + 1), count: n * m)
    var path = Array(repeating: Array(repeating: 0, count: k + 1), count: n * m)
    var result = Array(repeating: 0, count: k)
    var minPath = Int.max
    var minPathIndex = 0
    var visited = Array(repeating: Array(repeating: false, count: n * m), count: n * m)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0] = true
    while !queue.isEmpty {
        let (x, y, steps) = queue.removeFirst()
        if steps == k {
            if dp[x][y] > steps {
                dp[x][y] = steps
                path[x][y] = steps
            }
            if dp[x][y] < minPath {
                minPath = dp[x][y]
                minPathIndex = x * m + y
            }
        } else {
            for (dx, dy) in [(1, 0), (-1, 0), (0, 1), (0, -1)] {
                let nx = x + dx
                let ny = y + dy
                if nx >= 0 && nx < n && ny >= 0 && ny < m && !visited[nx * m + ny] {
                    visited[nx * m + ny] = true
                    queue.append((nx, ny, steps + 1))
                    visited[nx * m + ny] = false
                }
            }
        }
    }
    var index = minPathIndex
    for i in 0..<k {
        result[k - i - 1] = grid[index / m][index % m]
        index = path[index / m][index % m]
    }
    return result
}
```
visited[0] = true // cannot assign value of type 'Bool' to subscript of type '[Bool]'
if nx >= 0 && nx < n && ny >= 0 && ny < m && !visited[nx * m + ny] { // cannot convert value of type '[Bool]' to expected argument type 'Bool'
visited[nx * m + ny] = true // cannot assign value of type 'Bool' to subscript of type '[Bool]'
visited[nx * m + ny] = false // cannot assign value of type 'Bool' to subscript of type '[Bool]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: Int.max, count: m), count: n)
    var path = Array(repeating: Array(repeating: 0, count: m), count: n)
    var result = Array(repeating: 0, count: k)
    
    for i in 0..<n {
        for j in 0..<m {
            if i == 0 && j == 0 {
                dp[i][j] = grid[i][j]
            } else {
                for di in [-1, 0, 1] {
                    for dj in [-1, 0, 1] {
                        let ni = i + di
                        let nj = j + dj
                        if ni >= 0 && ni < n && nj >= 0 && nj < m {
                            dp[i][j] = min(dp[i][j], dp[ni][nj] + grid[i][j])
                        }
                    }
                }
            }
        }
    }
    
    var minPathLength = Int.max
    var minPathStart = (0, 0)
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][j] == dp[0][0] {
                var pathLength = 0
                var pathStart = (i, j)
                while pathLength < k {
                    path[pathLength] = grid[pathStart.0][pathStart.1]
                    pathLength += 1
                    for di in [-1, 0, 1] {
                        for dj in [-1, 0, 1] {
                            let ni = pathStart.0 + di
                            let nj = pathStart.1 + dj
                            if ni >= 0 && ni < n && nj >= 0 && nj < m {
                                if dp[ni][nj] == dp[pathStart.0][pathStart.1] - grid[pathStart.0][pathStart.1] {
                                    pathStart = (ni, nj)
                                    break
                                }
                            }
                        }
                    }
                }
                if pathLength == k {
                    if pathLength < minPathLength {
                        minPathLength = pathLength
                        minPathStart = pathStart
                    } else if pathLength == minPathLength {
                        if minPathStart.0 > pathStart.0 || (minPathStart.0 == pathStart.0 && minPathStart.1 > pathStart.1) {
                            minPathStart = pathStart
                        }
                    }
                }
            }
        }
    }
    
    var pathLength = 0
    var pathStart = minPathStart
    while pathLength < k {
        result[pathLength] = grid[pathStart.0][pathStart.1]
        pathLength += 1
        for di in [-1, 0, 1] {
            for dj in [-1, 0, 1] {
                let ni = pathStart.0 + di
                let nj = pathStart.1 + dj
                if ni >= 0 && ni < n && nj >= 0 && nj < m {
                    if dp[ni][nj] == dp[pathStart.0][pathStart.1] - grid[pathStart.0][pathStart.1] {
                        pathStart = (ni, nj)
                        break
                    }
                }
            }
        }
    }
    
    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] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: Int.max, count: m), count: n)
    var path = Array(repeating: Array(repeating: 0, count: m), count: n)
    var result = Array(repeating: 0, count: k)
    
    for i in 0..<n {
        for j in 0..<m {
            if i == 0 && j == 0 {
                dp[i][j] = grid[i][j]
            } else {
                for di in [-1, 0, 1] {
                    for dj in [-1, 0, 1] {
                        let ni = i + di
                        let nj = j + dj
                        if ni >= 0 && ni < n && nj >= 0 && nj < m {
                            dp[i][j] = min(dp[i][j], dp[ni][nj] + grid[i][j])
                        }
                    }
                }
            }
        }
    }
    
    var minPathLength = Int.max
    var minPathStart = (0, 0)
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][j] == dp[0][0] {
                var pathLength = 0
                var pathStart = (i, j)
                while pathLength < k {
                    path[pathLength] = grid[pathStart.0][pathStart.1]
                    pathLength += 1
                    for di in [-1, 0, 1] {
                        for dj in [-1, 0, 1] {
                            let ni = pathStart.0 + di
                            let nj = pathStart.1 + dj
                            if ni >= 0 && ni < n && nj >= 0 && nj < m {
                                if dp[ni][nj] == dp[pathStart.0][pathStart.1] - grid[pathStart.0][pathStart.1] {
                                    pathStart = (ni, nj)
                                    break
                                }
                            }
                        }
                    }
                }
                if pathLength == k {
                    if pathLength < minPathLength {
                        minPathLength = pathLength
                        minPathStart = pathStart
                    } else if pathLength == minPathLength {
                        if minPathStart.0 > pathStart.0 || (minPathStart.0 == pathStart.0 && minPathStart.1 > pathStart.1) {
                            minPathStart = pathStart
                        }
                    }
                }
            }
        }
    }
    
    var pathLength = 0
    var pathStart = minPathStart
    while pathLength < k {
        result[pathLength] = grid[pathStart.0][pathStart.1]
        pathLength += 1
        for di in [-1, 0, 1] {
            for dj in [-1, 0, 1] {
                let ni = pathStart.0 + di
                let nj = pathStart.1 + dj
                if ni >= 0 && ni < n && nj >= 0 && nj < m {
                    if dp[ni][nj] == dp[pathStart.0][pathStart.1] - grid[pathStart.0][pathStart.1] {
                        pathStart = (ni, nj)
                        break
                    }
                }
            }
        }
    }
    
    return result
}
```
path[pathLength] = grid[pathStart.0][pathStart.1] // cannot assign value of type 'Int' to subscript of type '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var result = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPath = [Int]()
    
    func dfs(row: Int, col: Int, pathLength: Int) {
        if pathLength == k {
            if pathLength < minPathLength {
                minPathLength = pathLength
                minPath = path
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= n || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        
        for (r, c) in [(row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)] {
            dfs(row: r, col: c, pathLength: pathLength + 1)
        }
        
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<n {
            visited = Array(repeating: Array(repeating: false, count: n), count: n)
            path = [Int]()
            dfs(row: i, col: j, pathLength: 0)
        }
    }
    
    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] {
    let n = grid.count
    var result = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var path = [Int]()
    var minPathLength = Int.max
    var minPath = [Int]()
    
    func dfs(row: Int, col: Int, pathLength: Int) {
        if pathLength == k {
            if pathLength < minPathLength {
                minPathLength = pathLength
                minPath = path
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= n || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        
        for (r, c) in [(row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)] {
            dfs(row: r, col: c, pathLength: pathLength + 1)
        }
        
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<n {
            visited = Array(repeating: Array(repeating: false, count: n), count: n)
            path = [Int]()
            dfs(row: i, col: j, pathLength: 0)
        }
    }
    
    return minPath
}
```
var result = [Int]() // initialization of variable 'result' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var minPath = [Int]()
    var minPathLength = Int.max
    var pathLength = 0
    var path = [Int]()
    
    func dfs(row: Int, col: Int, pathLength: Int) {
        if pathLength == k {
            if pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= n || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        dfs(row: row - 1, col: col, pathLength: pathLength + 1)
        dfs(row: row + 1, col: col, pathLength: pathLength + 1)
        dfs(row: row, col: col - 1, pathLength: pathLength + 1)
        dfs(row: row, col: col + 1, pathLength: pathLength + 1)
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<n {
            visited = Array(repeating: Array(repeating: false, count: n), count: n)
            path = [Int]()
            dfs(row: i, col: j, pathLength: 0)
        }
    }
    
    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] {
    let n = grid.count
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var minPath = [Int]()
    var minPathLength = Int.max
    var pathLength = 0
    var path = [Int]()
    
    func dfs(row: Int, col: Int, pathLength: Int) {
        if pathLength == k {
            if pathLength < minPathLength {
                minPath = path
                minPathLength = pathLength
            }
            return
        }
        
        if row < 0 || row >= n || col < 0 || col >= n || visited[row][col] {
            return
        }
        
        visited[row][col] = true
        path.append(grid[row][col])
        dfs(row: row - 1, col: col, pathLength: pathLength + 1)
        dfs(row: row + 1, col: col, pathLength: pathLength + 1)
        dfs(row: row, col: col - 1, pathLength: pathLength + 1)
        dfs(row: row, col: col + 1, pathLength: pathLength + 1)
        visited[row][col] = false
        path.removeLast()
    }
    
    for i in 0..<n {
        for j in 0..<n {
            visited = Array(repeating: Array(repeating: false, count: n), count: n)
            path = [Int]()
            dfs(row: i, col: j, pathLength: 0)
        }
    }
    
    return minPath
}
```
var pathLength = 0 // initialization of variable 'pathLength' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var visited = Array(repeating: Array(repeating: false, count: m), count: n)
    var path = [Int]()
    var minPath = [Int]()
    var minPathLength = Int.max
    var pathLength = 0
    var pathStart = 0
    var pathEnd = 0
    var pathDirection = 0
    var pathValue = 0
    var pathVisited = Array(repeating: Array(repeating: false, count: m), count: n)
    var pathVisitedCount = 0
    var pathVisitedValue = 0
    var pathVisitedDirection = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd = 0
    var pathVisitedDirection = 0
    var pathVisitedValue = 0
    var pathVisitedCount = 0
    var pathVisitedStart = 0
    var pathVisitedEnd =

```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: Int.max, count: k + 1), count: n * m)
    var path = Array(repeating: Array(repeating: 0, count: k + 1), count: n * m)
    var result = Array(repeating: 0, count: k)
    var minPath = Int.max
    var minPathIndex = 0
    var pathIndex = 0
    var pathValue = 0
    var pathLength = 0
    var pathValueIndex = 0
    var pathValueLength = 0
    var pathValueIndexValue = 0
    var pathValueLengthValue = 0
    var pathValueIndexValueIndex = 0
    var pathValueLengthValueIndex = 0
    var pathValueLengthValueIndexValue = 0
    var pathValueLengthValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndex = 0
    var pathValueLengthValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValueIndexValue =

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

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

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

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

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

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

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

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

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

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

func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var n = n, product = 1
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var n = n, product = 1
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var num = n
    var product = 1
    var hasOddDigit = false
    
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
            hasOddDigit = true
        }
        num /= 10
    }
    
    return hasOddDigit ? product : 0
}
```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 num = n
    var product = 1
    var hasOddDigit = false
    
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
            hasOddDigit = true
        }
        num /= 10
    }
    
    return hasOddDigit ? product : 0
}
```

func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var number = n
    var product = 1
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var number = n
    var product = 1
    while number > 0 {
        let digit = number % 10
        if digit % 2 != 0 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    let digits = String(n).map { Int(String($0))! }
    var product = 1
    for digit in digits {
        if digit % 2 != 0 {
            product *= digit
        }
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    let digits = String(n).map { Int(String($0))! }
    var product = 1
    for digit in digits {
        if digit % 2 != 0 {
            product *= digit
        }
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```

 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var num = n, product = 1
    while num > 0 {
        let digit = num % 10
        if digit % 2 != 0 {
            product *= digit
        }
        num /= 10
    }
    return product
}
```

 // 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 = [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 = [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 = [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 = [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 = [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 = [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 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 = [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 sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return sum
}
```
sum += roundedNum * roundedNum // cannot convert value of type 'Double' to expected argument type 'Int'

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) * 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)) * Int(ceil($0)) }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return Int(sum)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return Int(sum)
}
```
sum += roundedNum * roundedNum // cannot convert value of type 'Double' to expected argument type 'Int'

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        let roundedNum = ceil(num)
        sum += roundedNum * roundedNum
    }
    return sum
}
```
sum += roundedNum * roundedNum // cannot convert value of type 'Double' to expected argument type 'Int'

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) * 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)) * Int(ceil($0)) }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) * 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)) * Int(ceil($0)) }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($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 * $0)) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) * 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)) * Int(ceil($0)) }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { 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 { ceil($0) }.map { $0 * $0 }.reduce(0, +)
}
```

return lst.map { ceil($0) }.map { $0 * $0 }.reduce(0, +) // cannot convert value of type 'Double' to closure result type 'Int'

func sumSquares(lst: [Double]) -> Int {
    return lst.map { 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 { ceil($0) }.map { $0 * $0 }.reduce(0, +)
}
```

return lst.map { ceil($0) }.map { $0 * $0 }.reduce(0, +) // cannot convert value of type 'Double' to closure result type 'Int'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    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 {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    return false
}
```
if lastCharString.isLetter { // value of type 'String' has no member 'isLetter'
if words.last?.last == lastCharString { // cannot convert value of type 'String.Element?' (aka 'Optional<Character>') to expected argument type 'String'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    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 {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    return false
}
```

if lastCharString.isLetter { // value of type 'String' has no member 'isLetter'
if words.last?.last == lastCharString { // cannot convert value of type 'String.Element?' (aka 'Optional<Character>') to expected argument type 'String'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.components(separatedBy: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```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
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.components(separatedBy: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.split(separator: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```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
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.split(separator: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Check if the string is empty
    if txt.isEmpty {
        return false
    }
    
    // Get the last character of the string
    let lastChar = txt.last!
    
    // Check if the last character is an alphabetical character
    if lastChar.isLetter {
        // Check if the last character is not part of a word
        if txt.components(separatedBy: " ").last?.last == lastChar {
            return true
        }
    }
    
    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 {
    // Check if the string is empty
    if txt.isEmpty {
        return false
    }
    
    // Get the last character of the string
    let lastChar = txt.last!
    
    // Check if the last character is an alphabetical character
    if lastChar.isLetter {
        // Check if the last character is not part of a word
        if txt.components(separatedBy: " ").last?.last == lastChar {
            return true
        }
    }
    
    return false
}
```

 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord == nil {
        return false
    }
    let lastCharOfLastWord = lastWord?.last
    if lastCharOfLastWord == nil {
        return false
    }
    return lastChar == lastCharOfLastWord && lastCharOfLastWord?.isLetter == true
}
```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
    if lastChar == nil {
        return false
    }
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord == nil {
        return false
    }
    let lastCharOfLastWord = lastWord?.last
    if lastCharOfLastWord == nil {
        return false
    }
    return lastChar == lastCharOfLastWord && lastCharOfLastWord?.isLetter == true
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord?.hasSuffix(lastCharString) == true {
        return true
    } else {
        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 {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord?.hasSuffix(lastCharString) == true {
        return true
    } else {
        return false
    }
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.components(separatedBy: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```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
    if lastChar == nil {
        return false
    }
    let lastCharIsLetter = lastChar!.isLetter
    let lastCharIsPartOfWord = txt.components(separatedBy: " ").last?.last == lastChar
    return lastCharIsLetter && !lastCharIsPartOfWord
}
```

 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    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 {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let lastCharString = String(lastChar!)
    if lastCharString.isLetter {
        let words = txt.components(separatedBy: " ")
        if words.last?.last == lastCharString {
            return true
        }
    }
    return false
}
```
if lastCharString.isLetter { // value of type 'String' has no member 'isLetter'
if words.last?.last == lastCharString { // cannot convert value of type 'String.Element?' (aka 'Optional<Character>') to expected argument type 'String'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last
    if lastChar == nil {
        return false
    }
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord == nil {
        return false
    }
    let lastLetter = lastWord?.last
    if lastLetter == nil {
        return false
    }
    return lastLetter?.isLetter == true
}
```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
    if lastChar == nil {
        return false
    }
    let words = txt.components(separatedBy: " ")
    let lastWord = words.last
    if lastWord == nil {
        return false
    }
    let lastLetter = lastWord?.last
    if lastLetter == nil {
        return false
    }
    return lastLetter?.isLetter == true
}
```

 // XCTAssertTrue failed

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

func canArrange(arr: [Int]) -> Int {
    var index = arr.count - 1
    while index > 0 {
        if arr[index] < arr[index - 1] {
            return index
        }
        index -= 1
    }
    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 = arr.count - 1
    while index > 0 {
        if arr[index] < arr[index - 1] {
            return index
        }
        index -= 1
    }
    return -1
}
```

func canArrange(arr: [Int]) -> Int {
    var i = 1
    while i < arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
        i += 1
    }
    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 i = 1
    while i < arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
        i += 1
    }
    return -1
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    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 {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

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

 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    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 {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    return -1
}
```

 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    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 {
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            return i - 1
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

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

 // Fatal error: Range requires lowerBound <= upperBound

func canArrange(arr: [Int]) -> Int {
    var maxIndex = -1
    for i in 1..<arr.count {
        if arr[i] < arr[i - 1] {
            maxIndex = i - 1
            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 1..<arr.count {
        if arr[i] < arr[i - 1] {
            maxIndex = i - 1
            break
        }
    }
    return maxIndex
}
```

 // XCTAssertTrue failed

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

 // Fatal error: Range requires lowerBound <= upperBound

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || 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? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || num < smallestPositive {
                smallestPositive = num
            }
        }
    }
    
    return (largestNegative, smallestPositive)
}
```

if largestNegative == nil || num > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || num < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

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

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

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

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || 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? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || num < smallestPositive {
                smallestPositive = num
            }
        }
    }
    
    return (largestNegative, smallestPositive)
}
```

if largestNegative == nil || num > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || num < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNeg: Int? = nil
    var smallestPos: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNeg == nil || num > largestNeg {
                largestNeg = num
            }
        } else if num > 0 {
            if smallestPos == nil || num < smallestPos {
                smallestPos = num
            }
        }
    }
    
    return (largestNeg, smallestPos)
}
```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 largestNeg: Int? = nil
    var smallestPos: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNeg == nil || num > largestNeg {
                largestNeg = num
            }
        } else if num > 0 {
            if smallestPos == nil || num < smallestPos {
                smallestPos = num
            }
        }
    }
    
    return (largestNeg, smallestPos)
}

// Test cases
print(largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7])) // Output: (nil, 1)
print(largestSmallestIntegers(lst: [] as [Int])) // Output: (nil, nil)
print(largestSmallestIntegers(lst: [0])) // Output: (nil, nil)
```
if largestNeg == nil || num > largestNeg { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPos == nil || num < smallestPos { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int? = nil
    var smallestPositive: Int? = nil
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || 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? = nil
    var smallestPositive: Int? = nil
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || num < smallestPositive {
                smallestPositive = num
            }
        }
    }
    return (largestNegative, smallestPositive)
}
```

if largestNegative == nil || num > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || num < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || 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? = nil
    var smallestPositive: Int? = nil
    
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || num < smallestPositive {
                smallestPositive = num
            }
        }
    }
    
    return (largestNegative, smallestPositive)
}
```

if largestNegative == nil || num > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || num < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int? = nil
    var smallestPositive: Int? = nil
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || 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? = nil
    var smallestPositive: Int? = nil
    for num in lst {
        if num < 0 {
            if largestNegative == nil || num > largestNegative {
                largestNegative = num
            }
        } else if num > 0 {
            if smallestPositive == nil || num < smallestPositive {
                smallestPositive = num
            }
        }
    }
    return (largestNegative, smallestPositive)
}
```

if largestNegative == nil || num > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || num < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var smallestPositive: Int?
    var largestNegative: Int?
    
    for num in lst {
        if num > 0 {
            if let smallest = smallestPositive {
                if num < smallest {
                    smallestPositive = num
                }
            } else {
                smallestPositive = num
            }
        } else if num < 0 {
            if let largest = largestNegative {
                if num > largest {
                    largestNegative = num
                }
            } else {
                largestNegative = 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 smallestPositive: Int?
    var largestNegative: Int?
    
    for num in lst {
        if num > 0 {
            if let smallest = smallestPositive {
                if num < smallest {
                    smallestPositive = num
                }
            } else {
                smallestPositive = num
            }
        } else if num < 0 {
            if let largest = largestNegative {
                if num > largest {
                    largestNegative = num
                }
            } else {
                largestNegative = num
            }
        }
    }
    
    return (largestNegative, smallestPositive)
}

// Test cases
print(largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7])) // (nil, 1)
print(largestSmallestIntegers(lst: [] as [Int])) // (nil, nil)
print(largestSmallestIntegers(lst: [0])) // (nil, nil)
```

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let aInt), .intValue(let bInt)):
        if aInt > bInt {
            return .intValue(aInt)
        } else if aInt < bInt {
            return .intValue(bInt)
        } else {
            return nil
        }
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        if aDouble > bDouble {
            return .doubleValue(aDouble)
        } else if aDouble < bDouble {
            return .doubleValue(bDouble)
        } else {
            return nil
        }
    case (.stringValue(let aString), .stringValue(let bString)):
        if aString > bString {
            return .stringValue(aString)
        } else if aString < bString {
            return .stringValue(bString)
        } else {
            return 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 aInt), .intValue(let bInt)):
        if aInt > bInt {
            return .intValue(aInt)
        } else if aInt < bInt {
            return .intValue(bInt)
        } else {
            return nil
        }
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        if aDouble > bDouble {
            return .doubleValue(aDouble)
        } else if aDouble < bDouble {
            return .doubleValue(bDouble)
        } else {
            return nil
        }
    case (.stringValue(let aString), .stringValue(let bString)):
        if aString > bString {
            return .stringValue(aString)
        } else if aString < bString {
            return .stringValue(bString)
        } else {
            return nil
        }
    default:
        return nil
    }
}
```

 // 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 (.intValue(let aInt), .intValue(let bInt)):
        return aInt > bInt ? a : b
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        return aDouble > bDouble ? a : b
    case (.stringValue(let aString), .stringValue(let bString)):
        return aString > bString ? a : b
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let aInt), .intValue(let bInt)):
        return aInt > bInt ? a : b
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        return aDouble > bDouble ? a : b
    case (.stringValue(let aString), .stringValue(let bString)):
        return aString > bString ? a : b
    default:
        return nil
    }
}
```

 // XCTAssertTrue failed

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```

} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let aInt), .intValue(let bInt)):
        return aInt > bInt ? a : b
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        return aDouble > bDouble ? a : b
    case (.stringValue(let aString), .stringValue(let bString)):
        return aString > bString ? a : b
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let aInt), .intValue(let bInt)):
        return aInt > bInt ? a : b
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        return aDouble > bDouble ? a : b
    case (.stringValue(let aString), .stringValue(let bString)):
        return aString > bString ? a : b
    default:
        return nil
    }
}

// Test cases
print(compareOne(a: .intValue(1), b: .doubleValue(2.5))) // .doubleValue(2.5)
print(compareOne(a: .intValue(1), b: .stringValue("2,3"))) // .stringValue("2,3")
print(compareOne(a: .stringValue("5,1"), b: .stringValue("6"))) // .stringValue("6")
print(compareOne(a: .stringValue("1"), b: .intValue(1))) // nil
```

 // 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 (.intValue(let aInt), .intValue(let bInt)):
        if aInt > bInt { return .intValue(aInt) }
        if aInt < bInt { return .intValue(bInt) }
        return nil
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        if aDouble > bDouble { return .doubleValue(aDouble) }
        if aDouble < bDouble { return .doubleValue(bDouble) }
        return nil
    case (.stringValue(let aString), .stringValue(let bString)):
        if aString > bString { return .stringValue(aString) }
        if aString < bString { return .stringValue(bString) }
        return 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 aInt), .intValue(let bInt)):
        if aInt > bInt { return .intValue(aInt) }
        if aInt < bInt { return .intValue(bInt) }
        return nil
    case (.doubleValue(let aDouble), .doubleValue(let bDouble)):
        if aDouble > bDouble { return .doubleValue(aDouble) }
        if aDouble < bDouble { return .doubleValue(bDouble) }
        return nil
    case (.stringValue(let aString), .stringValue(let bString)):
        if aString > bString { return .stringValue(aString) }
        if aString < bString { return .stringValue(bString) }
        return nil
    default:
        return nil
    }
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 6 is divisible by 4
        return (n - 6) % 4 == 0
    }
    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 {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 6 is divisible by 4
        return (n - 6) % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        return n % 4 == 0
    }
    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 {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        return n % 4 == 0
    }
    return false
}

// Test cases to verify the correctness of the function
func testIsEqualToSumEven() {
    assert(isEqualToSumEven(n: 4) == false, "Test case 1 failed")
    assert(isEqualToSumEven(n: 6) == false, "Test case 2 failed")
    assert(isEqualToSumEven(n: 8) == true, "Test case 3 failed")
    assert(isEqualToSumEven(n: 10) == true, "Test case 4 failed")
    assert(isEqualToSumEven(n: 12) == true, "Test case 5 failed")
    assert(isEqualToSumEven(n: 14) == true, "Test case 6 failed")
    assert(isEqualToSumEven(n: 16) == true, "Test case 7 failed")
    assert(isEqualToSumEven(n: 18) == true, "Test case 8 failed")
    assert(isEqualToSumEven(n: 20) == true, "Test case 9 failed")
    assert(isEqualToSumEven(n: 22) == true, "Test case 10 failed")
    assert(isEqualToSumEven(n: 24) == true, "Test case 11 failed")
    assert(isEqualToSumEven(n: 26) == true, "Test case 12 failed")
    assert(isEqualToSumEven(n: 28) == true, "Test case 13 failed")
    assert(isEqualToSumEven(n: 30) == true, "Test case 14 failed")
    assert(isEqualToSumEven(n: 32) == true, "Test case 15 failed")
    assert(isEqualToSumEven(n: 34) == true, "Test case 16 failed")
    assert(isEqualToSumEven(n: 36) == true, "Test case 17 failed")
    assert(isEqualToSumEven(n: 38) == true, "Test case 18 failed")
    assert(isEqualToSumEven(n: 40) == true, "Test case 19 failed")
    assert(isEqualToSumEven(n: 42) == true, "Test case 20 failed")
    assert(isEqualToSumEven(n: 44) == true, "Test case 21 failed")
    assert(isEqualToSumEven(n: 46) == true, "Test case 22 failed")
    assert(isEqualToSumEven(n: 48) == true, "Test case 23 failed")
    assert(isEqualToSumEven(n: 50) == true, "Test case 24 failed")
    assert(isEqualToSumEven(n: 52) == true, "Test case 25 failed")
    assert(isEqualToSumEven(n: 54) == true, "Test case 26 failed")
    assert(isEqualToSumEven(n: 56) == true, "Test case 27 failed")
    assert(isEqualToSumEven(n: 58) == true, "Test case 28 failed")
    assert(isEqualToSumEven(n: 60) == true, "Test case 29 failed")
    assert(isEqualToSumEven(n: 62) == true, "Test case 30 failed")
    assert(isEqualToSumEven(n: 64) == true, "Test case 31 failed")
    assert(isEqualToSumEven(n: 66) == true, "Test case 32 failed")
    assert(isEqualToSumEven(n: 68) == true, "Test case 33 failed")
    assert(isEqualToSumEven(n: 70) == true, "Test case 34 failed")
    assert(isEqualToSumEven(n: 72) == true, "Test case 35 failed")
    assert(isEqualToSumEven(n: 74) == true, "Test case 36 failed")
    assert(isEqualToSumEven(n: 76) == true, "Test case 37 failed")
    assert(isEqualToSumEven(n: 78) == true, "Test case 38 failed")
    assert(isEqualToSumEven(n: 80) == true, "Test case 39 failed")
    assert(isEqualToSumEven(n: 82) == true, "Test case 40 failed")
    assert(isEqualToSumEven(n: 84) == true, "Test case 41 failed")
    assert(isEqualToSumEven(n:
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number can be written as the sum of 4 even numbers
        return n % 4 == 0
    }
    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 {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number can be written as the sum of 4 even numbers
        return n % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 6 is divisible by 4
        return (n - 6) % 4 == 0
    }
    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 {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 6 is divisible by 4
        return (n - 6) % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be written as the sum of 4 even numbers
        return n % 4 == 0
    }
    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 {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be written as the sum of 4 even numbers
        return n % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        for i in stride(from: 2, to: n/2, by: 2) {
            for j in stride(from: i, to: n/2, by: 2) {
                for k in stride(from: j, to: n/2, by: 2) {
                    for l in stride(from: k, to: n/2, by: 2) {
                        if i + j + k + l == n {
                            return true
                        }
                    }
                }
            }
        }
    }
    return false
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        for i in stride(from: 2, to: n/2, by: 2) {
            for j in stride(from: i, to: n/2, by: 2) {
                for k in stride(from: j, to: n/2, by: 2) {
                    for l in stride(from: k, to: n/2, by: 2) {
                        if i + j + k + l == n {
                            return true
                        }
                    }
                }
            }
        }
    }
    return false
}
```

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // If n is even and greater than or equal to 8, it can be written as the sum of 4 positive even numbers
        return true
    } else {
        // If n is not even or less than 8, it cannot be written as the sum of 4 positive even numbers
        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 {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // If n is even and greater than or equal to 8, it can be written as the sum of 4 positive even numbers
        return true
    } else {
        // If n is not even or less than 8, it cannot be written as the sum of 4 positive even numbers
        return false
    }
}
```

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        return n % 4 == 0
    }
    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 {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if n can be expressed as the sum of 4 even numbers
        return n % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Calculate the sum of the first 4 even numbers
        let sumOfEvens = 2 + 4 + 6 + 8
        // Check if n is equal to the sum of the first 4 even numbers
        return n == sumOfEvens
    }
    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 {
    // Check if n is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Calculate the sum of the first 4 even numbers
        let sumOfEvens = 2 + 4 + 6 + 8
        // Check if n is equal to the sum of the first 4 even numbers
        return n == sumOfEvens
    }
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 8 is divisible by 4
        return (n - 8) % 4 == 0
    }
    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 {
    // Check if the number is even and greater than or equal to 8
    if n % 2 == 0 && n >= 8 {
        // Check if the number minus 8 is divisible by 4
        return (n - 8) % 4 == 0
    }
    return false
}
```

 // XCTAssertTrue failed

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

func factorial(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 *= factorial(i)
    }
    return result
}

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

result *= factorial(i) // missing argument label 'n:' in call

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```

 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```

 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

// Test cases
print(specialFactorial(n: 4)) // Output: 288
print(specialFactorial(n: 5)) // Output: 34560
print(specialFactorial(n: 6)) // Output: 24883200
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```

 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```

 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
        } else {
            if spaceCount > 0 {
                result += "_"
                spaceCount = 0
            }
            result += String(char)
        }
    }
    if spaceCount > 0 {
        result += "-"
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
        } else {
            if spaceCount > 0 {
                result += "_"
                spaceCount = 0
            }
            result += String(char)
        }
    }
    if spaceCount > 0 {
        result += "-"
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for char in text {
        if char == " " {
            consecutiveSpaces += 1
            if consecutiveSpaces == 1 {
                result += "_"
            } else if consecutiveSpaces == 2 {
                result += "-"
            }
        } else {
            consecutiveSpaces = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for char in text {
        if char == " " {
            consecutiveSpaces += 1
            if consecutiveSpaces == 1 {
                result += "_"
            } else if consecutiveSpaces == 2 {
                result += "-"
            }
        } else {
            consecutiveSpaces = 0
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount > 2 {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount > 2 {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result.append("_")
            } else if spaceCount == 2 {
                result.append("-")
            }
        } else {
            spaceCount = 0
            result.append(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 spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result.append("_")
            } else if spaceCount == 2 {
                result.append("-")
            }
        } else {
            spaceCount = 0
            result.append(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result += "_"
            } else if spaceCount == 2 {
                result += "-"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result.append("_")
            } else if spaceCount == 2 {
                result.append("-")
            }
        } else {
            if spaceCount > 0 {
                if spaceCount == 1 {
                    result.append("_")
                } else if spaceCount == 2 {
                    result.append("-")
                }
                spaceCount = 0
            }
            result.append(char)
        }
    }
    
    if spaceCount > 0 {
        if spaceCount == 1 {
            result.append("_")
        } else if spaceCount == 2 {
            result.append("-")
        }
    }
    
    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 spaceCount = 0
    
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount == 1 {
                result.append("_")
            } else if spaceCount == 2 {
                result.append("-")
            }
        } else {
            if spaceCount > 0 {
                if spaceCount == 1 {
                    result.append("_")
                } else if spaceCount == 2 {
                    result.append("-")
                }
                spaceCount = 0
            }
            result.append(char)
        }
    }
    
    if spaceCount > 0 {
        if spaceCount == 1 {
            result.append("_")
        } else if spaceCount == 2 {
            result.append("-")
        }
    }
    
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    
    for char in text {
        if char == " " {
            spaceCount += 1
        } else {
            if spaceCount > 2 {
                result += "_"
            } else {
                result += String(char)
            }
            spaceCount = 0
        }
    }
    
    if spaceCount > 2 {
        result += "-"
    }
    
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    
    for char in text {
        if char == " " {
            spaceCount += 1
        } else {
            if spaceCount > 2 {
                result += "_"
            } else {
                result += String(char)
            }
            spaceCount = 0
        }
    }
    
    if spaceCount > 2 {
        result += "-"
    }
    
    return result
}
```

 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount > 2 {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaceCount = 0
    for char in text {
        if char == " " {
            spaceCount += 1
            if spaceCount > 2 {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            spaceCount = 0
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let allowedExtensions = ["txt", "exe", "dll"]
    let allowedAlphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let allowedDigits = "0123456789"
    let allowedCharacters = allowedAlphabets + allowedDigits + "."
    
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    guard components[0].rangeOfCharacter(from: allowedCharacters) != nil else { return "No" }
    guard components[1] == "txt" || components[1] == "exe" || components[1] == "dll" else { return "No" }
    guard components[0].rangeOfCharacter(from: allowedDigits) == nil else { return "No" }
    guard components[0].count <= 3 else { return "No" }
    
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let allowedExtensions = ["txt", "exe", "dll"]
    let allowedAlphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let allowedDigits = "0123456789"
    let allowedCharacters = allowedAlphabets + allowedDigits + "."
    
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    guard components[0].rangeOfCharacter(from: allowedCharacters) != nil else { return "No" }
    guard components[1] == "txt" || components[1] == "exe" || components[1] == "dll" else { return "No" }
    guard components[0].rangeOfCharacter(from: allowedDigits) == nil else { return "No" }
    guard components[0].count <= 3 else { return "No" }
    
    return "Yes"
}
```
guard components[0].rangeOfCharacter(from: allowedCharacters) != nil else { return "No" } // cannot convert value of type 'String' to expected argument type 'CharacterSet'
guard components[0].rangeOfCharacter(from: allowedDigits) == nil else { return "No" } // cannot convert value of type 'String' to expected argument type 'CharacterSet'

func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.count > 4 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    let dotIndex = fileName.firstIndex(of: ".") ?? fileName.endIndex
    if dotIndex == fileName.endIndex {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName[..<dotIndex]
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName[dotIndex...]
    let allowedExtensions = ["txt", "exe", "dll"]
    if !allowedExtensions.contains(afterDot.dropFirst().dropLast()) {
        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 {
    // Check if the file name contains more than three digits
    if fileName.count > 4 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    let dotIndex = fileName.firstIndex(of: ".") ?? fileName.endIndex
    if dotIndex == fileName.endIndex {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName[..<dotIndex]
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName[dotIndex...]
    let allowedExtensions = ["txt", "exe", "dll"]
    if !allowedExtensions.contains(afterDot.dropFirst().dropLast()) {
        return "No"
    }
    
    return "Yes"
}
```
if !allowedExtensions.contains(afterDot.dropFirst().dropLast()) { // instance method 'contains' requires the types 'String' and 'DropFirstSequence<String.SubSequence>.Element' (aka 'Character') be equivalent

func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").prefix(1)
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName.split(separator: ".").suffix(1)
    if !["txt", "exe", "dll"].contains(afterDot.first!) {
        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 {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").prefix(1)
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName.split(separator: ".").suffix(1)
    if !["txt", "exe", "dll"].contains(afterDot.first!) {
        return "No"
    }
    
    return "Yes"
}
```
if fileName.filter { $0.isNumber }.count > 3 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
if fileName.filter { $0 == "." }.count != 1 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
if beforeDot.isEmpty || !beforeDot.first!.isLetter { // value of type 'String.SubSequence' (aka 'Substring') has no member 'isLetter'

func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").first
    if beforeDot?.isEmpty ?? true || !beforeDot?.first?.isLetter ?? false {
        return "No"
    }
    
    // Check if the substring after the dot is one of these: ['txt', 'exe', 'dll']
    let afterDot = fileName.split(separator: ".").last
    if afterDot?.contains("txt") ?? false || afterDot?.contains("exe") ?? false || afterDot?.contains("dll") ?? false {
        return "Yes"
    } else {
        return "No"
    }
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").first
    if beforeDot?.isEmpty ?? true || !beforeDot?.first?.isLetter ?? false {
        return "No"
    }
    
    // Check if the substring after the dot is one of these: ['txt', 'exe', 'dll']
    let afterDot = fileName.split(separator: ".").last
    if afterDot?.contains("txt") ?? false || afterDot?.contains("exe") ?? false || afterDot?.contains("dll") ?? false {
        return "Yes"
    } else {
        return "No"
    }
}
```
if fileName.filter { $0.isNumber }.count > 3 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
if fileName.filter { $0 == "." }.count != 1 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
if beforeDot?.isEmpty ?? true || !beforeDot?.first?.isLetter ?? false { // optional type 'Bool?' cannot be used as a boolean; test for '== nil' instead

func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.range(of: "\\d{4,}") != nil {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.range(of: "\\.") == nil {
        return "No"
    }
    
    // Split the file name into two parts: before and after the dot
    let parts = fileName.components(separatedBy: ".")
    if parts.count != 2 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    if parts[0].isEmpty || !parts[0].range(of: "[a-zA-Z]")?.hasPrefix(1) == true {
        return "No"
    }
    
    // Check if the substring after the dot is one of these: ['txt', 'exe', 'dll']
    if parts[1] != "txt" && parts[1] != "exe" && parts[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 {
    // Check if the file name contains more than three digits
    if fileName.range(of: "\\d{4,}") != nil {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.range(of: "\\.") == nil {
        return "No"
    }
    
    // Split the file name into two parts: before and after the dot
    let parts = fileName.components(separatedBy: ".")
    if parts.count != 2 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    if parts[0].isEmpty || !parts[0].range(of: "[a-zA-Z]")?.hasPrefix(1) == true {
        return "No"
    }
    
    // Check if the substring after the dot is one of these: ['txt', 'exe', 'dll']
    if parts[1] != "txt" && parts[1] != "exe" && parts[1] != "dll" {
        return "No"
    }
    
    return "Yes"
}
```
if parts[0].isEmpty || !parts[0].range(of: "[a-zA-Z]")?.hasPrefix(1) == true { // optional type 'Optional<_>' cannot be used as a boolean; test for '== nil' instead
if parts[0].isEmpty || !parts[0].range(of: "[a-zA-Z]")?.hasPrefix(1) == true { // value of type 'Range<String.Index>' has no member 'hasPrefix'

func fileNameCheck(fileName: String) -> String {
    let allowedExtensions = ["txt", "exe", "dll"]
    let allowedCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let allowedDigits = "0123456789"
    
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    let fileNamePart = components[0]
    let extensionPart = components[1]
    
    if fileNamePart.isEmpty || !allowedCharacters.contains(fileNamePart.first!) {
        return "No"
    }
    
    if !allowedExtensions.contains(extensionPart) {
        return "No"
    }
    
    let digitsCount = fileNamePart.filter { $0.isNumber }.count
    if digitsCount > 3 {
        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 allowedExtensions = ["txt", "exe", "dll"]
    let allowedCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let allowedDigits = "0123456789"
    
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    let fileNamePart = components[0]
    let extensionPart = components[1]
    
    if fileNamePart.isEmpty || !allowedCharacters.contains(fileNamePart.first!) {
        return "No"
    }
    
    if !allowedExtensions.contains(extensionPart) {
        return "No"
    }
    
    let digitsCount = fileNamePart.filter { $0.isNumber }.count
    if digitsCount > 3 {
        return "No"
    }
    
    return "Yes"
}
```
let allowedDigits = "0123456789" // initialization of immutable value 'allowedDigits' was never used; consider replacing with assignment to '_' or removing it

func fileNameCheck(fileName: String) -> String {
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    let beforeDot = components[0]
    let afterDot = components[1]
    guard beforeDot.rangeOfCharacter(from: CharacterSet.decimalDigits) == nil else { return "No" }
    guard afterDot == "txt" || afterDot == "exe" || afterDot == "dll" else { return "No" }
    guard beforeDot.rangeOfCharacter(from: CharacterSet.letters) != nil else { return "No" }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let components = fileName.components(separatedBy: ".")
    guard components.count == 2 else { return "No" }
    let beforeDot = components[0]
    let afterDot = components[1]
    guard beforeDot.rangeOfCharacter(from: CharacterSet.decimalDigits) == nil else { return "No" }
    guard afterDot == "txt" || afterDot == "exe" || afterDot == "dll" else { return "No" }
    guard beforeDot.rangeOfCharacter(from: CharacterSet.letters) != nil else { return "No" }
    return "Yes"
}
```

 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.(txt|exe|dll)$", options: [])
    let matches = regex.matches(in: fileName, options: [], range: NSRange(location: 0, length: fileName.utf16.count))
    return matches.count > 0 ? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.(txt|exe|dll)$", options: [])
    let matches = regex.matches(in: fileName, options: [], range: NSRange(location: 0, length: fileName.utf16.count))
    return matches.count > 0 ? "Yes" : "No"
}
```

 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").first!
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName.split(separator: ".").last!
    if !["txt", "exe", "dll"].contains(afterDot) {
        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 {
    // Check if the file name contains more than three digits
    if fileName.filter { $0.isNumber }.count > 3 {
        return "No"
    }
    
    // Check if the file name contains exactly one dot
    if fileName.filter { $0 == "." }.count != 1 {
        return "No"
    }
    
    // Check if the substring before the dot is not empty and starts with a letter
    let beforeDot = fileName.split(separator: ".").first!
    if beforeDot.isEmpty || !beforeDot.first!.isLetter {
        return "No"
    }
    
    // Check if the substring after the dot is one of the allowed extensions
    let afterDot = fileName.split(separator: ".").last!
    if !["txt", "exe", "dll"].contains(afterDot) {
        return "No"
    }
    
    return "Yes"
}
```
if fileName.filter { $0.isNumber }.count > 3 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
if fileName.filter { $0 == "." }.count != 1 { // trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.(txt|exe|dll)$")
    return regex.firstMatch(in: fileName, options: [], range: NSRange(location: 0, length: fileName.utf16.count)) != nil ? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.(txt|exe|dll)$")
    return regex.firstMatch(in: fileName, options: [], range: NSRange(location: 0, length: fileName.utf16.count)) != nil ? "Yes" : "No"
}
```

 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
let primeLengths = words.map { $0.count }.filter { isPrime($0) } // missing argument label 'number:' in call

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { words[$0] }.joined(separator: " ")
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { words[$0] }.joined(separator: " ")
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
let primeLengths = words.map { $0.count }.filter { isPrime($0) } // missing argument label 'number:' in call

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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

 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { words[$0] }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// 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 primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { words[$0] }.joined(separator: " ")
}

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

 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<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.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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 wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { String($0.count) }.filter { isPrime($0) }
    return primeLengths.joined(separator: " ")
}

func isPrime(_ num: String) -> Bool {
    guard let num = Int(num) else { return false }
    if num < 2 { 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.split(separator: " ")
    let primeLengths = words.map { String($0.count) }.filter { isPrime($0) }
    return primeLengths.joined(separator: " ")
}

func isPrime(_ num: String) -> Bool {
    guard let num = Int(num) else { return false }
    if num < 2 { return false }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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

 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { Int(String($0))! }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 { return false }
    for i in 2..<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.split(separator: " ")
    let primeLengths = words.map { Int(String($0))! }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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

 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    guard num > 1 else { 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.split(separator: " ")
    let primeLengths = words.map { $0.count }.filter { isPrime($0) }
    return primeLengths.map { String($0) }.joined(separator: " ")
}

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

 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    let simplifiedX = (xNumerator / gcd, xDenominator / gcd)
    let simplifiedN = (nNumerator / gcd, nDenominator / gcd)
    return simplifiedX.0 == simplifiedN.0 && simplifiedX.1 == simplifiedN.1
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var gcd = gcd(a, b)
    gcd = gcd(gcd, c)
    gcd = gcd(gcd, d)
    return gcd
}

func gcd(_ 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
// 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 xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    let simplifiedX = (xNumerator / gcd, xDenominator / gcd)
    let simplifiedN = (nNumerator / gcd, nDenominator / gcd)
    return simplifiedX.0 == simplifiedN.0 && simplifiedX.1 == simplifiedN.1
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var gcd = gcd(a, b)
    gcd = gcd(gcd, c)
    gcd = gcd(gcd, d)
    return gcd
}

func gcd(_ a: Int, _ b: Int) -> Int {
    var a = a
    var b = b
    while b != 0 {
        let temp = b
        b = a % b
        a = temp
    }
    return a
}
```

gcd = gcd(gcd, c) // cannot call value of non-function type 'Int'
gcd = gcd(gcd, d) // cannot call value of non-function type 'Int'

func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Split the fractions into their numerator and denominator
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    
    // Convert the numerator and denominator to integers
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    // Calculate the product of the numerators and denominators
    let productNumerator = xNumerator * nNumerator
    let productDenominator = xDenominator * nDenominator
    
    // Check if the product of the numerators and denominators is a whole number
    return productNumerator % productDenominator == 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 {
    // Split the fractions into their numerator and denominator
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    
    // Convert the numerator and denominator to integers
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    // Calculate the product of the numerators and denominators
    let productNumerator = xNumerator * nNumerator
    let productDenominator = xDenominator * nDenominator
    
    // Check if the product of the numerators and denominators is a whole number
    return productNumerator % productDenominator == 0
}
```

func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    // Your code here
}
```

} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    let simplifiedX = (xNumerator / gcd, xDenominator / gcd)
    let simplifiedN = (nNumerator / gcd, nDenominator / gcd)
    
    return simplifiedX.0 * simplifiedN.1 == simplifiedX.1 * simplifiedN.0
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var a = abs(a)
    var b = abs(b)
    var c = abs(c)
    var d = abs(d)
    
    while b != 0 {
        (b, a) = (a % b, b)
    }
    
    while c != 0 {
        (c, d) = (d % c, c)
    }
    
    return a + d
}
```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 xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    let simplifiedX = (xNumerator / gcd, xDenominator / gcd)
    let simplifiedN = (nNumerator / gcd, nDenominator / gcd)
    
    return simplifiedX.0 * simplifiedN.1 == simplifiedX.1 * simplifiedN.0
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var a = abs(a)
    var b = abs(b)
    var c = abs(c)
    var d = abs(d)
    
    while b != 0 {
        (b, a) = (a % b, b)
    }
    
    while c != 0 {
        (c, d) = (d % c, c)
    }
    
    return a + d
}
```

 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    return (xNumerator * nDenominator) % gcd == 0 && (nNumerator * xDenominator) % gcd == 0
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var a = abs(a), b = abs(b), c = abs(c), d = abs(d)
    while b != 0 {
        (a, b) = (b, a % b)
    }
    while c != 0 {
        (c, d) = (d, c % d)
    }
    return a * d
}
```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 xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    let gcd = gcd(xNumerator, xDenominator, nNumerator, nDenominator)
    return (xNumerator * nDenominator) % gcd == 0 && (nNumerator * xDenominator) % gcd == 0
}

func gcd(_ a: Int, _ b: Int, _ c: Int, _ d: Int) -> Int {
    var a = abs(a), b = abs(b), c = abs(c), d = abs(d)
    while b != 0 {
        (a, b) = (b, a % b)
    }
    while c != 0 {
        (c, d) = (d, c % d)
    }
    return a * d
}
```

 // Fatal error: Division by zero in remainder operation

func simplify(x: String, n: String) -> Bool {
    // Split the fractions into numerators and denominators
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    
    // Convert the numerators and denominators to integers
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    // Calculate the product of the numerators and denominators
    let productNumerator = xNumerator * nNumerator
    let productDenominator = xDenominator * nDenominator
    
    // Check if the product is a whole number
    return productNumerator % productDenominator == 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 {
    // Split the fractions into numerators and denominators
    let xParts = x.components(separatedBy: "/")
    let nParts = n.components(separatedBy: "/")
    
    // Convert the numerators and denominators to integers
    let xNumerator = Int(xParts[0])!
    let xDenominator = Int(xParts[1])!
    let nNumerator = Int(nParts[0])!
    let nDenominator = Int(nParts[1])!
    
    // Calculate the product of the numerators and denominators
    let productNumerator = xNumerator * nNumerator
    let productDenominator = xDenominator * nDenominator
    
    // Check if the product is a whole number
    return productNumerator % productDenominator == 0
}
```

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // Your code here
}
```

} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (num1, num2) -> Bool in
        let sum1 = sumOfDigits(num1)
        let sum2 = sumOfDigits(num2)
        if sum1 == sum2 {
            return nums.firstIndex(of: num1)! < nums.firstIndex(of: num2)!
        }
        return sum1 < sum2
    }
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (num1, num2) -> Bool in
        let sum1 = sumOfDigits(num1)
        let sum2 = sumOfDigits(num2)
        if sum1 == sum2 {
            return nums.firstIndex(of: num1)! < nums.firstIndex(of: num2)!
        }
        return sum1 < sum2
    }
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```

 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (num1, num2) -> Bool in
        let sum1 = sumOfDigits(num1)
        let sum2 = sumOfDigits(num2)
        if sum1 == sum2 {
            return nums.firstIndex(of: num1)! < nums.firstIndex(of: num2)!
        } else {
            return sum1 < sum2
        }
    }
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (num1, num2) -> Bool in
        let sum1 = sumOfDigits(num1)
        let sum2 = sumOfDigits(num2)
        if sum1 == sum2 {
            return nums.firstIndex(of: num1)! < nums.firstIndex(of: num2)!
        } else {
            return sum1 < sum2
        }
    }
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```

 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (a, b) -> Bool in
        let sumA = a.abs().map { String($0) }.joined().reduce(0, +)
        let sumB = b.abs().map { String($0) }.joined().reduce(0, +)
        return sumA == sumB ? nums.firstIndex(of: a)! < nums.firstIndex(of: b)! : sumA < sumB
    }
}
```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 sumA = a.abs().map { String($0) }.joined().reduce(0, +)
        let sumB = b.abs().map { String($0) }.joined().reduce(0, +)
        return sumA == sumB ? nums.firstIndex(of: a)! < nums.firstIndex(of: b)! : sumA < sumB
    }
}
```
let sumA = a.abs().map { String($0) }.joined().reduce(0, +) // value of type 'Int' has no member 'abs'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (a, b) -> Bool in
        let sumA = a.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 })
        let sumB = b.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 })
        if sumA == sumB {
            return nums.firstIndex(of: a)! < nums.firstIndex(of: b)!
        } else {
            return sumA < sumB
        }
    }
}
```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 sumA = a.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 })
        let sumB = b.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 })
        if sumA == sumB {
            return nums.firstIndex(of: a)! < nums.firstIndex(of: b)!
        } else {
            return sumA < sumB
        }
    }
}
```

let sumA = a.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 }) // value of type 'Int' has no member 'abs'
let sumA = a.abs().map { String($0).asciiValue! }.reduce(0, { $0 + $1 }) // reference to member 'asciiValue' cannot be resolved without a contextual type

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        let digits = num.abs().map { String($0) }.joined()
        if digits.first! == "1" || digits.first! == "3" || digits.first! == "5" || digits.first! == "7" || digits.first! == "9" {
            if digits.last! == "1" || digits.last! == "3" || digits.last! == "5" || digits.last! == "7" || digits.last! == "9" {
                if num > 10 {
                    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 {
        let digits = num.abs().map { String($0) }.joined()
        if digits.first! == "1" || digits.first! == "3" || digits.first! == "5" || digits.first! == "7" || digits.first! == "9" {
            if digits.last! == "1" || digits.last! == "3" || digits.last! == "5" || digits.last! == "7" || digits.last! == "9" {
                if num > 10 {
                    count += 1
                }
            }
        }
    }
    return count
}
```

let digits = num.abs().map { String($0) }.joined() // value of type 'Int' has no member 'abs'

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(firstDigit(num)) && isOdd(lastDigit(num)) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}

func firstDigit(_ num: Int) -> Int {
    return abs(num) % 10
}

func lastDigit(_ num: Int) -> Int {
    return abs(num) % 10
}
```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 && isOdd(num) && isOdd(firstDigit(num)) && isOdd(lastDigit(num)) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}

func firstDigit(_ num: Int) -> Int {
    return abs(num) % 10
}

func lastDigit(_ num: Int) -> Int {
    return abs(num) % 10
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) {
            count += 1
        }
    }
    return count
}

func isOdd(num: Int) -> Bool {
    let lastDigit = abs(num) % 10
    let firstDigit = abs(num) / 100000
    return lastDigit % 2 != 0 && firstDigit % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) {
            count += 1
        }
    }
    return count
}

func isOdd(num: Int) -> Bool {
    let lastDigit = abs(num) % 10
    let firstDigit = abs(num) / 100000
    return lastDigit % 2 != 0 && firstDigit % 2 != 0
}
```

if num > 10 && isOdd(num) { // missing argument label 'num:' in call

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num % 10) && isOdd(num / 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num % 10) && isOdd(num / 10) {
            count += 1
        }
    }
    return count
}

// Helper function to check if a number is odd
func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(abs(num) % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(abs(num) % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    let lastDigit = abs(num) % 10
    let firstDigit = abs(num) / 100000
    return lastDigit % 2 == 1 && firstDigit % 2 == 1
}
```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 && isOdd(num) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    let lastDigit = abs(num) % 10
    let firstDigit = abs(num) / 100000
    return lastDigit % 2 == 1 && firstDigit % 2 == 1
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(abs(num) % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(abs(num) % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) {
            if isOdd(abs(num) % 10) && isOdd(abs(num) / 10) {
                count += 1
            }
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) {
            if isOdd(abs(num) % 10) && isOdd(abs(num) / 10) {
                count += 1
            }
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num / 10) && isOdd(num % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num / 10) && isOdd(num % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num / 10) && isOdd(num % 10) {
            count += 1
        }
    }
    return count
}

func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && isOdd(num) && isOdd(num / 10) && isOdd(num % 10) {
            count += 1
        }
    }
    return count
}

// Helper function to check if a number is odd
func isOdd(_ num: Int) -> Bool {
    return num % 2 != 0
}
```

 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

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

} // missing return in global function expected to return '[String]'

func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let filteredList = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered list by length and then alphabetically
    let sortedList = filteredList.sorted { $0.count < $1.count || $0 < $1 }
    
    return sortedList
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let filteredList = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered list by length and then alphabetically
    let sortedList = filteredList.sorted { $0.count < $1.count || $0 < $1 }
    
    return sortedList
}
```

func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for str in lst {
        if str.count % 2 == 0 {
            result.append(str)
        }
    }
    return result.sorted { $0.count < $1.count }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for str in lst {
        if str.count % 2 == 0 {
            result.append(str)
        }
    }
    return result.sorted { $0.count < $1.count }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var oddLengthWords = [String]()
    var sortedWords = [String]()
    for word in lst {
        if word.count % 2 == 1 {
            oddLengthWords.append(word)
        } else {
            sortedWords.append(word)
        }
    }
    sortedWords.sort()
    sortedWords.append(contentsOf: oddLengthWords)
    return sortedWords
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var oddLengthWords = [String]()
    var sortedWords = [String]()
    for word in lst {
        if word.count % 2 == 1 {
            oddLengthWords.append(word)
        } else {
            sortedWords.append(word)
        }
    }
    sortedWords.sort()
    sortedWords.append(contentsOf: oddLengthWords)
    return sortedWords
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let filteredList = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered list by length and then alphabetically
    let sortedList = filteredList.sorted { $0.count < $1.count || $0.count == $1.count && $0 < $1 }
    
    return sortedList
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let filteredList = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered list by length and then alphabetically
    let sortedList = filteredList.sorted { $0.count < $1.count || $0.count == $1.count && $0 < $1 }
    
    return sortedList
}
```

func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```

 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let evenLengthStrings = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered strings by length, then alphabetically
    let sortedStrings = evenLengthStrings.sorted { $0.count < $1.count || $0 < $1 }
    
    return sortedStrings
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    // Filter out strings with odd lengths
    let evenLengthStrings = lst.filter { $0.count % 2 == 0 }
    
    // Sort the filtered strings by length, then alphabetically
    let sortedStrings = evenLengthStrings.sorted { $0.count < $1.count || $0 < $1 }
    
    return sortedStrings
}
```

func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted { $0.count < $1.count }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted { $0.count < $1.count }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.filter { $0.count % 2 == 0 }
    sortedList.sort { $0.count < $1.count }
    return sortedList
}
```

 // XCTAssertTrue failed

func xOrY(n: Int, x: Int, y: Int) -> Int {
    var result: Int
    if isPrime(n) {
        result = x
    } else {
        result = y
    }
    return result
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    var result: Int
    if isPrime(n) {
        result = x
    } else {
        result = y
    }
    return result
}

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

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple program which should return true if n is a prime number
// and should return false otherwise.
// Examples:
// isPrime(n: 7) == true
// isPrime(n: 15) == false
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple function to check if a number is prime or not.
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}
```

if isPrime(n) { // cannot find 'isPrime' in scope

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple function which should return true if the given number is a prime number and false otherwise.
// Examples:
// isPrime(n: 7) == true
// isPrime(n: 15) == false
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple function to check if a number is prime or not
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// Helper function to check if a number is prime
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple program which should return true if n is a prime number
// and should return false otherwise.
// Examples:
// isPrime(n: 7) == true
// isPrime(n: 15) == false
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// A simple program which should return true if n is a prime number and should return false otherwise.
// Examples:
// isPrime(n: 7) == true
// isPrime(n: 15) == false
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
if isPrime(n) { // missing argument label 'n:' in call

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if isPrime(n) {
        return x
    } else {
        return y
    }
}

// Helper function to check if a number is prime
func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

if isPrime(n) { // missing argument label 'n:' in call

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(pow(num, 2))
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(pow(num, 2))
        }
    }
    return sum
}
```

if num.isInteger && num > 0 && num % 2 != 0 { // value of type 'Double' has no member 'isInteger'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum * 2
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum * 2
}
```

if num.isInteger && num > 0 && num % 2 != 0 { // value of type 'Double' has no member 'isInteger'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum
}

func check() {
    assert(doubleTheDifference(lst: [1, 3, 2, 0]) == 10)
    assert(doubleTheDifference(lst: [-1, -2, 0]) == 0)
    assert(doubleTheDifference(lst: [9, -2]) == 81)
    assert(doubleTheDifference(lst: [0]) == 0)
    print("All tests passed successfully.")
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum
}

// Check function to verify the correctness of the solution
func check() {
    assert(doubleTheDifference(lst: [1, 3, 2, 0]) == 10)
    assert(doubleTheDifference(lst: [-1, -2, 0]) == 0)
    assert(doubleTheDifference(lst: [9, -2]) == 81)
    assert(doubleTheDifference(lst: [0]) == 0)
    print("All tests passed successfully.")
}

// Running the check function to verify the solution
check()
```

if num.isInteger && num > 0 && num % 2 != 0 { // value of type 'Double' has no member 'isInteger'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.isInteger && num > 0 && num % 2 != 0 {
            sum += Int(num * num)
        }
    }
    return sum
}
```
if num.isInteger && num > 0 && num % 2 != 0 { // value of type 'Double' has no member 'isInteger'

func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredList = lst.filter { (num) -> Bool in
        return num >= 0 && num.isInteger
    }
    
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredList.reduce(0) { (result, num) -> Int in
        if num.isOdd {
            return result + Int(num * num)
        }
        return result
    }
    
    // Return the sum of squares multiplied by 2
    return sumOfSquares * 2
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredList = lst.filter { (num) -> Bool in
        return num >= 0 && num.isInteger
    }
    
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredList.reduce(0) { (result, num) -> Int in
        if num.isOdd {
            return result + Int(num * num)
        }
        return result
    }
    
    // Return the sum of squares multiplied by 2
    return sumOfSquares * 2
}
```
let filteredList = lst.filter { (num) -> Bool in // trailing closure passed to parameter of type 'Predicate<Double>' that does not accept a closure
return result + Int(num * num) // no exact matches in call to initializer

func doubleTheDifference(lst: [Double]) -> Int {
    let oddSquares = lst.filter { $0.isInteger && $0 > 0 && $0 % 2 != 0 }.map { $0 * $0 }
    return oddSquares.reduce(0, +) * 2
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    let oddSquares = lst.filter { $0.isInteger && $0 > 0 && $0 % 2 != 0 }.map { $0 * $0 }
    return oddSquares.reduce(0, +) * 2
}
```

let oddSquares = lst.filter { $0.isInteger && $0 > 0 && $0 % 2 != 0 }.map { $0 * $0 } // trailing closure passed to parameter of type 'Predicate<Double>' that does not accept a closure

func doubleTheDifference(lst: [Double]) -> Int {
    let filteredNumbers = lst.filter { (num) -> Bool in
        return num.isInteger && num > 0 && num % 2 != 0
    }
    let squaredNumbers = filteredNumbers.map { $0 * $0 }
    let sumOfSquares = squaredNumbers.reduce(0, +)
    return Int(sumOfSquares * 2)
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    let filteredNumbers = lst.filter { (num) -> Bool in
        return num.isInteger && num > 0 && num % 2 != 0
    }
    let squaredNumbers = filteredNumbers.map { $0 * $0 }
    let sumOfSquares = squaredNumbers.reduce(0, +)
    return Int(sumOfSquares * 2)
}
```
let filteredNumbers = lst.filter { (num) -> Bool in // trailing closure passed to parameter of type 'Predicate<Double>' that does not accept a closure

func doubleTheDifference(lst: [Double]) -> Int {
    let filteredNumbers = lst.filter { $0.isInteger && $0 >= 0 && $0 % 2 != 0 }
    let squaredNumbers = filteredNumbers.map { $0 * $0 }
    return squaredNumbers.reduce(0, +)
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    let filteredNumbers = lst.filter { $0.isInteger && $0 >= 0 && $0 % 2 != 0 }
    let squaredNumbers = filteredNumbers.map { $0 * $0 }
    return squaredNumbers.reduce(0, +)
}
```
let filteredNumbers = lst.filter { $0.isInteger && $0 >= 0 && $0 % 2 != 0 } // trailing closure passed to parameter of type 'Predicate<Double>' that does not accept a closure

func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredNumbers = lst.filter { $0 >= 0 && Int($0) == $0 }
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredNumbers.filter { $0.isInteger && $0 % 2 != 0 }.map { $0 * $0 }.reduce(0, +)
    // Return the sum of squares multiplied by 2
    return Int(sumOfSquares * 2)
}

func check() {
    assert(doubleTheDifference(lst: [1, 3, 2, 0]) == 10)
    assert(doubleTheDifference(lst: [-1, -2, 0]) == 0)
    assert(doubleTheDifference(lst: [9, -2]) == 81)
    assert(doubleTheDifference(lst: [0]) == 0)
    print("All tests passed.")
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredNumbers = lst.filter { $0 >= 0 && Int($0) == $0 }
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredNumbers.filter { $0.isInteger && $0 % 2 != 0 }.map { $0 * $0 }.reduce(0, +)
    // Return the sum of squares multiplied by 2
    return Int(sumOfSquares * 2)
}

// Check function to verify the correctness of the solution
func check() {
    assert(doubleTheDifference(lst: [1, 3, 2, 0]) == 10)
    assert(doubleTheDifference(lst: [-1, -2, 0]) == 0)
    assert(doubleTheDifference(lst: [9, -2]) == 81)
    assert(doubleTheDifference(lst: [0]) == 0)
    print("All tests passed.")
}

// Run the check function to verify the solution
check()
```

func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredNumbers = lst.filter { $0 >= 0 && Int($0) == $0 }
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredNumbers.map { Int($0) }.filter { $0 % 2 != 0 }.map { $0 * $0 }.reduce(0, +)
    return sumOfSquares * 2
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    // Filter out negative numbers and non-integer numbers
    let filteredNumbers = lst.filter { $0 >= 0 && Int($0) == $0 }
    // Calculate the sum of squares of odd numbers
    let sumOfSquares = filteredNumbers.map { Int($0) }.filter { $0 % 2 != 0 }.map { $0 * $0 }.reduce(0, +)
    return sumOfSquares * 2
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] != guess[i] {
            result.append(abs(game[i] - guess[i]))
        } else {
            result.append(0)
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] != guess[i] {
            result.append(abs(game[i] - guess[i]))
        } else {
            result.append(0)
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        result.append(abs(game[i] - guess[i]))
    }
    return result
}
```

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    
    for extension in extensions {
        let strength = calculateStrength(extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            strongestExtension = extension < strongestExtension ? extension : strongestExtension
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    
    for extension in extensions {
        let strength = calculateStrength(extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            strongestExtension = extension < strongestExtension ? extension : strongestExtension
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = calculateStrength(extension: extension) // consecutive statements on a line must be separated by ';'
let strength = calculateStrength(extension: extension) // declaration is only valid at file scope
let strength = calculateStrength(extension: extension) // expected '{' in extension
let strength = calculateStrength(extension: extension) // expected type name in extension declaration
let strength = calculateStrength(extension: extension) // missing argument for parameter 'extension' in call
let strength = calculateStrength(extension: extension) // expected expression in list of expressions
strongestExtension = extension // expected '{' in extension
strongestExtension = extension // expected expression in assignment
strongestExtension = extension // declaration is only valid at file scope
} else if strength == maxStrength { // expected type name in extension declaration
strongestExtension = extension < strongestExtension ? extension : strongestExtension // expected type name in extension declaration
strongestExtension = extension < strongestExtension ? extension : strongestExtension // expected '{' in extension
strongestExtension = extension < strongestExtension ? extension : strongestExtension // declaration is only valid at file scope
strongestExtension = extension < strongestExtension ? extension : strongestExtension // declaration is only valid at file scope
strongestExtension = extension < strongestExtension ? extension : strongestExtension // expected expression in assignment
strongestExtension = extension < strongestExtension ? extension : strongestExtension // expected type name in extension declaration
strongestExtension = extension < strongestExtension ? extension : strongestExtension // expected '{' in extension
for char in extension { // expected '{' to start the body of for-each loop
for char in extension { // expected Sequence expression for for-each loop

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension: String = ""
    var maxStrength: Double = 0.0
    
    for extension in extensions {
        let strength = calculateStrength(extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if extension < strongestExtension {
                strongestExtension = extension
            }
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(extension: String) -> Double {
    var strength = 0.0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension: String = ""
    var maxStrength: Double = 0.0
    
    for extension in extensions {
        let strength = calculateStrength(extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if extension < strongestExtension {
                strongestExtension = extension
            }
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(extension: String) -> Double {
    var strength = 0.0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```

for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = calculateStrength(extension: extension) // consecutive statements on a line must be separated by ';'
let strength = calculateStrength(extension: extension) // declaration is only valid at file scope
let strength = calculateStrength(extension: extension) // expected '{' in extension
let strength = calculateStrength(extension: extension) // expected type name in extension declaration
let strength = calculateStrength(extension: extension) // missing argument for parameter 'extension' in call
let strength = calculateStrength(extension: extension) // expected expression in list of expressions
strongestExtension = extension // expected '{' in extension
strongestExtension = extension // expected expression in assignment
strongestExtension = extension // declaration is only valid at file scope
} else if strength == maxStrength { // expected type name in extension declaration
if extension < strongestExtension { // declaration is only valid at file scope
if extension < strongestExtension { // expected type name in extension declaration
if extension < strongestExtension { // expected expression, var, or let in 'if' condition
if extension < strongestExtension { // expected '{' in extension
for char in extension { // expected '{' to start the body of for-each loop
for char in extension { // expected Sequence expression for for-each loop

```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    let class = className.lowercased()
    var strongest = ""
    var maxStrength = -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
XCTAssertTrue(Strongest_Extension(className: "Watashi", extensions: ["tEN", "niNE", "eIGHt8OKe"]) == "Watashi.eIGHt8OKe") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "Boku123", extensions: ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"]) == "Boku123.YEs.WeCaNe") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "__YESIMHERE", extensions: ["t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"]) == "__YESIMHERE.NuLl__") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "K", extensions: ["Ta", "TAR", "t234An", "cosSo"]) == "K.TAR") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "__HAHA", extensions: ["Tab", "123", "781345", "--"]) == "__HAHA.123") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "YameRore", extensions: ["HhAas", "okIWILL123", "WorkOut", "Fails", "--"]) == "YameRore.okIWILL123") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "finNNalLLly", extensions: ["Die", "NowW", "Wow", "WoW"]) == "finNNalLLly.WoW") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "", extensions: ["Bb", "91245"]) == ".Bb") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "Sp", extensions: ["671235", "Bb"]) == "Sp.671235") // cannot find 'Strongest_Extension' in scope

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```

} // missing return in global function expected to return 'String'

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```

} // missing return in global function expected to return 'String'

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    
    for extension in extensions {
        let strength = calculateStrength(extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if className + "." + extension > className + "." + strongestExtension {
                strongestExtension = extension
            }
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(_ extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    
    for extension in extensions {
        let strength = calculateStrength(extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if className + "." + extension > className + "." + strongestExtension {
                strongestExtension = extension
            }
        }
    }
    
    return "\(className).\(strongestExtension)"
}

func calculateStrength(_ extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = calculateStrength(extension) // expected '{' in extension
let strength = calculateStrength(extension) // expected type name in extension declaration
let strength = calculateStrength(extension) // declaration is only valid at file scope
let strength = calculateStrength(extension) // missing argument for parameter #1 in call
let strength = calculateStrength(extension) // consecutive statements on a line must be separated by ';'
let strength = calculateStrength(extension) // expected expression in list of expressions
strongestExtension = extension // expected '{' in extension
strongestExtension = extension // expected expression in assignment
strongestExtension = extension // declaration is only valid at file scope
} else if strength == maxStrength { // expected type name in extension declaration
if className + "." + extension > className + "." + strongestExtension { // declaration is only valid at file scope
if className + "." + extension > className + "." + strongestExtension { // expected '{' in extension
if className + "." + extension > className + "." + strongestExtension { // expected expression after operator
if className + "." + extension > className + "." + strongestExtension { // expected type name in extension declaration
for char in extension { // expected '{' to start the body of for-each loop
for char in extension { // expected Sequence expression for for-each loop

func Strongest_Extension(className: String, extensions: [String]) -> String {
    let class = className.lowercased()
    var strongestExtension = ""
    var maxStrength = Int.min
    for extension in extensions {
        let extensionName = extension.lowercased()
        let strength = strengthOfExtension(extensionName)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extensionName
        } else if strength == maxStrength {
            if extensionName < strongestExtension {
                strongestExtension = extensionName
            }
        }
    }
    return "\(class)\(strongestExtension)"
}

func strengthOfExtension(_ extensionName: String) -> Int {
    let uppercaseCount = extensionName.filter { $0.isUppercase }.count
    let lowercaseCount = extensionName.filter { $0.isLowercase }.count
    return uppercaseCount - lowercaseCount
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    let class = className.lowercased()
    var strongestExtension = ""
    var maxStrength = Int.min
    for extension in extensions {
        let extensionName = extension.lowercased()
        let strength = strengthOfExtension(extensionName)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extensionName
        } else if strength == maxStrength {
            if extensionName < strongestExtension {
                strongestExtension = extensionName
            }
        }
    }
    return "\(class)\(strongestExtension)"
}

func strengthOfExtension(_ extensionName: String) -> Int {
    let uppercaseCount = extensionName.filter { $0.isUppercase }.count
    let lowercaseCount = extensionName.filter { $0.isLowercase }.count
    return uppercaseCount - lowercaseCount
}
```
let class = className.lowercased() // keyword 'class' cannot be used as an identifier here
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
let extensionName = extension.lowercased() // expected initial value after '='
let extensionName = extension.lowercased() // consecutive statements on a line must be separated by ';'
let extensionName = extension.lowercased() // declaration is only valid at file scope
let extensionName = extension.lowercased() // expected '{' in extension
let extensionName = extension.lowercased() // expected type name in extension declaration
return "\(class)\(strongestExtension)" // expected expression in list of expressions
return "\(class)\(strongestExtension)" // missing argument for parameter #1 in call

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    for extension in extensions {
        let strength = calculateStrength(extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if className + "." + extension > className + "." + strongestExtension {
                strongestExtension = extension
            }
        }
    }
    return "\(className).\(strongestExtension)"
}

func calculateStrength(_ extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var strongestExtension = ""
    var maxStrength = Int.min
    for extension in extensions {
        let strength = calculateStrength(extension)
        if strength > maxStrength {
            maxStrength = strength
            strongestExtension = extension
        } else if strength == maxStrength {
            if className + "." + extension > className + "." + strongestExtension {
                strongestExtension = extension
            }
        }
    }
    return "\(className).\(strongestExtension)"
}

func calculateStrength(_ extension: String) -> Int {
    var strength = 0
    for char in extension {
        if char.isUppercase {
            strength += 1
        } else if char.isLowercase {
            strength -= 1
        }
    }
    return strength
}
```
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = calculateStrength(extension) // expected type name in extension declaration
let strength = calculateStrength(extension) // declaration is only valid at file scope
let strength = calculateStrength(extension) // missing argument for parameter #1 in call
let strength = calculateStrength(extension) // consecutive statements on a line must be separated by ';'
let strength = calculateStrength(extension) // expected expression in list of expressions
let strength = calculateStrength(extension) // expected '{' in extension
strongestExtension = extension // expected expression in assignment
strongestExtension = extension // expected '{' in extension
strongestExtension = extension // declaration is only valid at file scope
} else if strength == maxStrength { // expected type name in extension declaration
if className + "." + extension > className + "." + strongestExtension { // expected type name in extension declaration
if className + "." + extension > className + "." + strongestExtension { // declaration is only valid at file scope
if className + "." + extension > className + "." + strongestExtension { // expected expression after operator
if className + "." + extension > className + "." + strongestExtension { // expected '{' in extension
for char in extension { // expected '{' to start the body of for-each loop
for char in extension { // expected Sequence expression for for-each loop

func Strongest_Extension(className: String, extensions: [String]) -> String {
    let class = className.lowercased()
    let extensions = extensions.map { $0.lowercased() }
    let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
    let strongestExtension = extensions.max { (a, b) -> Bool in
        let aStrength = a.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - a.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
        let bStrength = b.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - b.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
        return aStrength < bStrength
    }
    return "\(class)\(strongestExtension ?? "")"
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    let class = className.lowercased()
    let extensions = extensions.map { $0.lowercased() }
    let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
    let strongestExtension = extensions.max { (a, b) -> Bool in
        let aStrength = a.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - a.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
        let bStrength = b.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - b.map { $0.isLowercase ? 1 : 0 }.reduce(0, +)
        return aStrength < bStrength
    }
    return "\(class)\(strongestExtension ?? "")"
}
```
let class = className.lowercased() // keyword 'class' cannot be used as an identifier here
let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +) // expected identifier in class declaration
let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +) // consecutive statements on a line must be separated by ';'
let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +) // expected initial value after '='
let classStrength = class.map { $0.isUppercase ? 1 : 0 }.reduce(0, +) - class.map { $0.isLowercase ? 1 : 0 }.reduce(0, +) // expected identifier in class declaration
return "\(class)\(strongestExtension ?? "")" // missing argument for parameter #1 in call
return "\(class)\(strongestExtension ?? "")" // expected expression in list of expressions

```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    let classParts = className.components(separatedBy: ".")
    let classExtension = classParts.last!
    let classPartsWithoutExtension = classParts.dropLast()
    let classPartsWithoutExtensionString = classPartsWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArray = classPartsWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString.components(separatedBy: ".")
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArray.dropLast()
    let classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionString = classPartsWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtensionStringArrayWithoutExtension.joined(separator:
XCTAssertTrue(Strongest_Extension(className: "Watashi", extensions: ["tEN", "niNE", "eIGHt8OKe"]) == "Watashi.eIGHt8OKe") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "Boku123", extensions: ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"]) == "Boku123.YEs.WeCaNe") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "__YESIMHERE", extensions: ["t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"]) == "__YESIMHERE.NuLl__") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "K", extensions: ["Ta", "TAR", "t234An", "cosSo"]) == "K.TAR") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "__HAHA", extensions: ["Tab", "123", "781345", "--"]) == "__HAHA.123") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "YameRore", extensions: ["HhAas", "okIWILL123", "WorkOut", "Fails", "--"]) == "YameRore.okIWILL123") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "finNNalLLly", extensions: ["Die", "NowW", "Wow", "WoW"]) == "finNNalLLly.WoW") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "", extensions: ["Bb", "91245"]) == ".Bb") // cannot find 'Strongest_Extension' in scope
XCTAssertTrue(Strongest_Extension(className: "Sp", extensions: ["671235", "Bb"]) == "Sp.671235") // cannot find 'Strongest_Extension' in scope

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasPrefix(b[i..<i+b.count]) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasPrefix(b[i..<i+b.count]) {
            return true
        }
    }
    return false
}
```

if a.hasPrefix(b[i..<i+b.count]) { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    // Check if the length of b is greater than a
    if b.count > a.count {
        return false
    }
    
    // Check if b is a substring of a
    if a.contains(b) {
        return true
    }
    
    // Check if any rotation of b is a substring of a
    for i in 0..<b.count {
        let rotated = b.dropFirst() + b.first!
        if a.contains(rotated) {
            return true
        }
    }
    
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    // Check if the length of b is greater than a
    if b.count > a.count {
        return false
    }
    
    // Check if b is a substring of a
    if a.contains(b) {
        return true
    }
    
    // Check if any rotation of b is a substring of a
    for i in 0..<b.count {
        let rotated = b.dropFirst() + b.first!
        if a.contains(rotated) {
            return true
        }
    }
    
    return false
}
```
let rotated = b.dropFirst() + b.first! // binary operator '+' cannot be applied to operands of type 'String.SubSequence' (aka 'Substring') and 'String.Element' (aka 'Character')

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```
if a.hasSuffix(b[i..<b.count]) { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count - a.count {
        if b[i..<i+a.count] == a {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count - a.count {
        if b[i..<i+a.count] == a {
            return true
        }
    }
    return false
}
```

if b[i..<i+a.count] == a { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b.first!
    }
    return b.contains(a)
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b.first!
    }
    return b.contains(a)
}
```

b = b + b.first! // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```

if a.hasSuffix(b[i..<b.count]) { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b.first!
        if a.contains(b) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b.first!
        if a.contains(b) {
            return true
        }
    }
    return false
}
```
b = b + b.first! // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasPrefix(b[i..<i+b.count]) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasPrefix(b[i..<i+b.count]) {
            return true
        }
    }
    return false
}
```

if a.hasPrefix(b[i..<i+b.count]) { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let b = b + b
    for i in 0..<b.count {
        if a.hasSuffix(b[i..<b.count]) {
            return true
        }
    }
    return false
}
```

if a.hasSuffix(b[i..<b.count]) { // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b
    }
    return b.contains(a)
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var b = b
    for _ in 0..<b.count {
        b = b + b
    }
    return b.contains(a)
}
```

 // XCTAssertTrue failed

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = Array(String(num).filter { $0 != "-" })
    var evenCount = 0, oddCount = 0
    for digit in digits {
        if Int(digit) % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = Array(String(num).filter { $0 != "-" })
    var evenCount = 0, oddCount = 0
    for digit in digits {
        if Int(digit) % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```

if Int(digit) % 2 == 0 { // no exact matches in call to initializer

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```
 // XCTAssertTrue failed

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```

 // XCTAssertTrue failed

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```

 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```

 // XCTAssertTrue failed

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    let numString = String(abs(num))
    for digit in numString {
        if Int(String(digit))! % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    let numString = String(abs(num))
    for digit in numString {
        if Int(String(digit))! % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    var num = abs(num)
    while num > 0 {
        let digit = num % 10
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    return (evenCount, oddCount)
}
```

 // XCTAssertTrue failed

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```

 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = Array(String(num))
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if Int(digit) % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = Array(String(num))
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if Int(digit) % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```
if Int(digit) % 2 == 0 { // no exact matches in call to initializer

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).map { Int(String($0))! }
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func intToMiniRoman(number: Int) -> String {
    let romanNumerals: [Int: String] = [
        1000: "m", 900: "cm", 500: "d", 400: "cd",
        100: "c", 90: "xc", 50: "l", 40: "xl",
        10: "x", 9: "ix", 5: "v", 4: "iv", 1: "i"
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals: [Int: String] = [
        1000: "m", 900: "cm", 500: "d", 400: "cd",
        100: "c", 90: "xc", 50: "l", 40: "xl",
        10: "x", 9: "ix", 5: "v", 4: "iv", 1: "i"
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}

// Test cases
print(intToMiniRoman(number: 19)) // Output: "xix"
print(intToMiniRoman(number: 152)) // Output: "clii"
print(intToMiniRoman(number: 426)) // Output: "cdxxvi"
```
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}

// Test cases
print(intToMiniRoman(number: 19)) // Output: "xix"
print(intToMiniRoman(number: 152)) // Output: "clii"
print(intToMiniRoman(number: 426)) // Output: "cdxxvi"
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var num = number
    var result = ""
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var num = number
    var result = ""
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var num = number
    var result = ""
    
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var result = ""
    var num = number
    for (value, symbol) in romanNumerals {
        while num >= value {
            result += symbol
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var result = ""
    var num = number
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"), (900, "cm"), (500, "d"), (400, "cd"),
        (100, "c"), (90, "xc"), (50, "l"), (40, "xl"),
        (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")
    ]
    var result = ""
    var num = number
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    return result
}
```

func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var result = ""
    var num = number
    
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let romanNumerals = [
        (1000, "m"),
        (900, "cm"),
        (500, "d"),
        (400, "cd"),
        (100, "c"),
        (90, "xc"),
        (50, "l"),
        (40, "xl"),
        (10, "x"),
        (9, "ix"),
        (5, "v"),
        (4, "iv"),
        (1, "i")
    ]
    
    var result = ""
    var num = number
    
    for (value, numeral) in romanNumerals {
        while num >= value {
            result += numeral
            num -= value
        }
    }
    
    return result
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] == sides[0] + sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] == sides[0] + sides[1]
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    let sides = [a, b, c].sorted()
    return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            maxWord = min(maxWord, word)
        }
    }
    
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars || (uniqueChars == maxUniqueChars && word < maxWord) {
            maxUniqueChars = uniqueChars
            maxWord = word
        }
    }
    
    return maxWord
}
```

func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var maxUniqueChars = 0
    var maxWord = ""
    
    for word in words {
        let uniqueChars = Set(word).count
        if uniqueChars > maxUniqueChars {
            maxUniqueChars = uniqueChars
            maxWord = word
        } else if uniqueChars == maxUniqueChars {
            if word < maxWord {
                maxWord = word
            }
        }
    }
    
    return maxWord
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    if need > remaining {
        eaten += remaining
        return [eaten, 0]
    } else {
        eaten += need
        return [eaten, remaining - need]
    }
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    if need > remaining {
        eaten += remaining
        return [eaten, 0]
    } else {
        eaten += need
        return [eaten, remaining - need]
    }
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        eaten += need
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        eaten += need
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var left = remaining
    if need > left {
        eaten += left
        left = 0
    } else {
        left -= need
    }
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var left = remaining
    if need > left {
        eaten += left
        left = 0
    } else {
        left -= need
    }
    return [eaten, left]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = min(need, remaining)
    let remainingAfterEating = remaining - eaten
    return [number + eaten, remainingAfterEating]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = min(need, remaining)
    let remainingAfterEating = remaining - eaten
    return [number + eaten, remainingAfterEating]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        eaten += need
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remainingCarrots = remaining
    if need > remainingCarrots {
        eaten += remainingCarrots
        remainingCarrots = 0
    } else {
        eaten += need
        remainingCarrots -= need
    }
    return [eaten, remainingCarrots]
}
```

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number
    var remaining = remaining
    if need > remaining {
        eaten += remaining
        remaining = 0
    } else {
        eaten += need
        remaining -= need
    }
    return [eaten, remaining]
}
```

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "//":
            result /= operandValue
        case "**":
            result = pow(Double(result), Double(operandValue))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "//":
            result /= operandValue
        case "**":
            result = pow(Double(result), Double(operandValue))
        default:
            break
        }
    }
    return result
}
```
result = pow(Double(result), Double(operandValue)) // cannot assign value of type 'Double' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = pow(Double(result), Double(operand))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = pow(Double(result), Double(operand))
        default:
            break
        }
    }
    return result
}
```
result = pow(Double(result), Double(operand)) // cannot assign value of type 'Double' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var stack = [Int]()
    for i in 0..<operators.count {
        let op = operators[i]
        let operand1 = operands[i]
        let operand2 = operands[i + 1]
        switch op {
        case "+":
            stack.append(operand1 + operand2)
        case "-":
            stack.append(operand1 - operand2)
        case "*":
            stack.append(operand1 * operand2)
        case "/":
            stack.append(operand1 / operand2)
        case "**":
            stack.append(operand1 ** operand2)
        default:
            break
        }
    }
    return stack.last!
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var stack = [Int]()
    for i in 0..<operators.count {
        let op = operators[i]
        let operand1 = operands[i]
        let operand2 = operands[i + 1]
        switch op {
        case "+":
            stack.append(operand1 + operand2)
        case "-":
            stack.append(operand1 - operand2)
        case "*":
            stack.append(operand1 * operand2)
        case "/":
            stack.append(operand1 / operand2)
        case "**":
            stack.append(operand1 ** operand2)
        default:
            break
        }
    }
    return stack.last!
}
```
stack.append(operand1 ** operand2) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "/":
            result /= operandValue
        case "**":
            result = pow(Double(result), Double(operandValue))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "/":
            result /= operandValue
        case "**":
            result = pow(Double(result), Double(operandValue))
        default:
            break
        }
    }
    return result
}
```
result = pow(Double(result), Double(operandValue)) // cannot assign value of type 'Double' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "/":
            result /= operandValue
        case "**":
            result = Int(pow(Double(result), Double(operandValue)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operandValue = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operandValue
        case "-":
            result -= operandValue
        case "*":
            result *= operandValue
        case "/":
            result /= operandValue
        case "**":
            result = Int(pow(Double(result), Double(operandValue)))
        default:
            break
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operand = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorValue = operators[i]
        let operand = operands[i + 1]
        switch operatorValue {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorString = operators[i]
        let operand = operands[i + 1]
        switch operatorString {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "/":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorString = operators[i]
        let operand = operands[i + 1]
        switch operatorString {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "/":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "/":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        let operatorSymbol = operators[i]
        let operand = operands[i + 1]
        switch operatorSymbol {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "/":
            result /= operand
        case "**":
            result = Int(pow(Double(result), Double(operand)))
        default:
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result == "" ? String(result.reversed()) : result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result == "" ? String(result.reversed()) : result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            if char.isLowercase {
                result += String(char.uppercased())
            } else {
                result += String(char.lowercased())
            }
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            if char.isLowercase {
                result += String(char.uppercased())
            } else {
                result += String(char.lowercased())
            }
        } else {
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result == "" ? String(result.reversed()) : result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? char.uppercased() : char.lowercased()
        } else {
            result += String(char)
        }
    }
    return result == "" ? String(result.reversed()) : result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            result += char.isLowercase ? String(char.uppercased()) : String(char.lowercased())
        } else {
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            if char.isLowercase {
                result += String(char.uppercased())
            } else {
                result += String(char.lowercased())
            }
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for char in s {
        if char.isLetter {
            if char.isLowercase {
                result += String(char.uppercased())
            } else {
                result += String(char.lowercased())
            }
        } else {
            result += String(char)
        }
    }
    return result
}
```

 // XCTAssertTrue failed

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    CC_MD5_Final(&digest, context)
    return digest.map { String(format: "%02x", $0) }.joined()
}

func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "d0a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    CC_MD5_Final(&digest, context)
    return digest.map { String(format: "%02x", $0) }.joined()
}

// Check function to verify the correctness of the generated function.
func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "d0a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}

// Run the check function to verify the correctness of the stringToMd5 function.
check()
```

CC_MD5_Init(context) // 'CC_MD5_Init' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Int' to expected argument type 'CC_LONG' (aka 'UInt32')
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Data' to expected argument type 'UnsafeRawPointer?'
CC_MD5_Final(&digest, context) // 'CC_MD5_Final' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_Final(&digest, context) // 'CC_MD5_Final' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    let md5String = digest.map { String(format: "%02x", $0) }.joined()
    context.deallocate()
    return md5String
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    let md5String = digest.map { String(format: "%02x", $0) }.joined()
    context.deallocate()
    return md5String
}
```

CC_MD5_Init(context) // 'CC_MD5_Init' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Data' to expected argument type 'UnsafeRawPointer?'
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Int' to expected argument type 'CC_LONG' (aka 'UInt32')
CC_MD5_Final(&digest, context) // 'CC_MD5_Final' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}
```

return text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}

func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "2e202e0a79dbc69b674cd4ec67a72c62")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}

// Check function to verify the correctness of the 'stringToMd5' function.
func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "2e202e0a79dbc69b674cd4ec67a72c62")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}

// Run the check function to verify the correctness of the 'stringToMd5' function.
check()
```

return text.md5() // value of type 'String' has no member 'md5'
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    return text.md5()
}
```

return text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    let md5String = digest.map { String(format: "%02x", $0) }.joined()
    context.deallocate()
    return md5String
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    let md5String = digest.map { String(format: "%02x", $0) }.joined()
    context.deallocate()
    return md5String
}
```

CC_MD5_Init(context) // 'CC_MD5_Init' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Data' to expected argument type 'UnsafeRawPointer?'
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Int' to expected argument type 'CC_LONG' (aka 'UInt32')
CC_MD5_Final(&digest, context) // 'CC_MD5_Final' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).

import CommonCrypto
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    let digest = UnsafeMutablePointer<UInt8>.allocate(capacity: CC_MD5_DIGEST_LENGTH)
    CC_MD5_Final(digest, context)
    let md5String = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String2 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String3 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String4 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String5 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String6 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String7 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String8 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String9 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String10 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String11 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String12 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String13 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String14 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Final(digest, context)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count
XCTAssertTrue(stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62") // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "") == nil) // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "A B C") == "0ef78513b0cb8cef12743f5aeb35f888") // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "password") == "5f4dcc3b5aa765d61d8327deb882cf99") // cannot find 'stringToMd5' in scope

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    CC_MD5_FreeContext(context)
    return digest.map { String(format: "%02x", $0) }.joined()
}

func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "23d6916c7f5a4b78841573828b288d37")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
    CC_MD5_Final(&digest, context)
    CC_MD5_FreeContext(context)
    return digest.map { String(format: "%02x", $0) }.joined()
}

// Check function to verify the correctness of the generated function.
func check() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift is awesome", "23d6916c7f5a4b78841573828b288d37")
    ]
    
    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if result == expected {
            print("Test passed for input: \(input)")
        } else {
            print("Test failed for input: \(input). Expected \(expected), got \(result)")
        }
    }
}

// Run the check function to verify the correctness of the stringToMd5 function.
check()
```

CC_MD5_Init(context) // 'CC_MD5_Init' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Int' to expected argument type 'CC_LONG' (aka 'UInt32')
CC_MD5_Update(context, data, data.count) // cannot convert value of type 'Data' to expected argument type 'UnsafeRawPointer?'
CC_MD5_Final(&digest, context) // 'CC_MD5_Final' was deprecated in macOS 10.15: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).
CC_MD5_FreeContext(context) // cannot find 'CC_MD5_FreeContext' in scope
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?
print("Test failed for input: \(input). Expected \(expected), got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?

import CommonCrypto

func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)
    guard let digest = data?.md5() else { return nil }
    return digest.map { String(format: "%02hhx", $0) }.joined()
}

func testStringToMd5() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift", "23d5796b9c9c9c9c9c9c9c9c9c9c9c9c"),
        ("123456", "e10adc3949ba59abbe56e057f20f883e")
    ]

    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if let result = result, result == expected {
            print("Test passed for input: \(input)")
        } else if let result = result {
            print("Test failed for input: \(input). Expected \(expected) but got \(result)")
        } else {
            print("Test failed for input: \(input). Expected nil but got \(result)")
        }
    }
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)
    guard let digest = data?.md5() else { return nil }
    return digest.map { String(format: "%02hhx", $0) }.joined()
}

// Test cases to verify the correctness of the function
func testStringToMd5() {
    let testCases = [
        ("Hello world", "3e25960a79dbc69b674cd4ec67a72c62"),
        ("", nil),
        ("Swift", "23d5796b9c9c9c9c9c9c9c9c9c9c9c9c"),
        ("123456", "e10adc3949ba59abbe56e057f20f883e")
    ]

    for (input, expected) in testCases {
        let result = stringToMd5(text: input)
        if let result = result, result == expected {
            print("Test passed for input: \(input)")
        } else if let result = result {
            print("Test failed for input: \(input). Expected \(expected) but got \(result)")
        } else {
            print("Test failed for input: \(input). Expected nil but got \(result)")
        }
    }
}

// Run the test cases
testStringToMd5()
```

guard let digest = data?.md5() else { return nil } // value of type 'Data' has no member 'md5'
print("Test failed for input: \(input). Expected \(expected) but got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?
print("Test failed for input: \(input). Expected nil but got \(result)") // string interpolation produces a debug description for an optional value; did you mean to make this explicit?

import CommonCrypto
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    guard !text.isEmpty else { return nil }
    let data = text.data(using: .utf8)!
    let context = UnsafeMutablePointer<CC_MD5_CTX>.allocate(capacity: 1)
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    let digest = UnsafeMutablePointer<UInt8>.allocate(capacity: CC_MD5_DIGEST_LENGTH)
    CC_MD5_Final(digest, context)
    let md5String = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String2 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String3 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String4 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String5 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String6 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String7 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String8 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String9 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String10 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String11 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String12 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String13 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String14 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String15 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String16 = digest.withMemoryRebound(to: String.self, capacity: 1) { $0.pointee }
    CC_MD5_Init(context)
    CC_MD5_Update(context, data, data.count)
    CC_MD5_Final(digest, context)
    let md5String17 = digest.withMemoryRebound
XCTAssertTrue(stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62") // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "") == nil) // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "A B C") == "0ef78513b0cb8cef12743f5aeb35f888") // cannot find 'stringToMd5' in scope
XCTAssertTrue(stringToMd5(text: "password") == "5f4dcc3b5aa765d61d8327deb882cf99") // cannot find 'stringToMd5' in scope

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```

 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```

 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```

 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```

 // Fatal error: Range requires lowerBound <= upperBound