https://leetcode.com/problems/determine-if-string-halves-are-alike/description/ Easy

Решение

class Solution {
    fun halvesAreAlike(s: String): Boolean {
        val vowels = setOf('a','e','i','o','u','A','E','I','O','U')
        val n = s.length / 2
        var count = 0
        for (i in 0 until n) {
            if (s[i] in vowels) count++
            if (s[i + n] in vowels) count--
        }
        return count == 0
    }
}