NOMURA OA 2023 | Number of Good Ways to Split a String | Java Solution | Prefix & Suffix Distinct Count
Question · Posted Jun 2026
Problem Statement You are given a string s. A split is called good if the string is divided into two non-empty parts s1 and s2 such that: s1 = s[0...i] s2 = s[i+1...n-1] The split is considered good when the number of distinct characters in s1 is equal to the number of distinct characters in s2. Return the total number of good splits. Example 1 Input s = "aacaba" Output 2 Explanation Possible splits: a | acaba -> ...
The full answer & interview discussion are available to premium members.
Log in Create a free account