Eaton Corporation Hiring OA 2024 | Determine if String Halves Are Alike | String Processing

Question · Posted Jun 2026

Problem Statement Given a string s of even length, divide it into two equal halves. The first half contains the first n/2 characters. The second half contains the remaining n/2 characters. A string is said to be alike if both halves contain the same number of vowels. Return: true if the two halves are alike. false otherwise. The vowels are: a, e, i, o, u A, E, I, O, U Example 1 Input s = "book" Output true Explanation First ...

The full answer & interview discussion are available to premium members.

Log in Create a free account