This is a verified interview question from Uber-she%2B%2B. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Count Special Segments in a String" covers key patterns like Strings.
"In Uber's routing system, each planned ride route is represented as a sequence of lowercase letters in the string rideRoute, where each character corresponds to a checkpoint. A segment of the route is defined as any non-empty consecutive portion of rideRoute. A segment is considered special if: 1. The segment forms a palindrome (it reads the same forward and backward). 2. The segment contains at least one vowel (a, e, i, o, or u). The task is to determine the number of distinct special segments that exist within the given rideRoute. ### Example rideRoute = "uber" Route Segments of "uber" are: - Length 1: "u", "b", "e", "r" - Length 2: "ub", "be", "er" - Length 3: "ube", "ber" - Length 4: "uber" Only "u" and "e" are the two special segments."
Join thousands of developers practicing for Uber-she%2B%2B.