Company: amazon_15feb

Difficulty: medium

Problem Statement

Question 2 Problem Description In a prompt engineering pipeline, a text string called prompt is tokenized into individual characters for analysis. Implement a function that identifies the most frequently occurring token (character) in prompt . If multiple characters have the same maximum frequency, return the one that appears earliest in the string. The function should return the most frequently occurring character (token), applying tie-breaking rules as specified. Note: The analysis is case-sensitive. For example: 'X' and 'x' are different characters. Function Signature You are expected to complete the following function: char getMostFrequentToken(string prompt) The function is expected to return a CHARACTER . The function accepts STRING prompt as parameter. Constraints 1 <= length of prompt <= 10^4 Input Format For Custom Testing The first line contains a string, prompt , denoting the text to be analyzed. Examples Sample Case 0 Sample Input For Custom Testing STDIN Function ---

More amazon_15feb OA questionsInterview experiences