Round 1
Questions: At the TikTok academy, students are learning how to improve video captions. You are given a string caption that only has small English letters (a to z). You can make two kinds of changes to the caption at any letter as many times as needed:
- Change the letter to the one right before it in the alphabet. You cannot change 'a' because it is already the first letter.
- Change the letter to the one right after it in the alphabet. You cannot change 'z' because it is already the last letter.
Your task is to make sure that every letter in the caption has at least one same letter next to it. For example, "aaabb" and "aaccdd" are good captions, but "abaaa" and "abcdef" are not.
Examples:
- caption = "aca"
- You can change "c" to "b" (the letter before), then to "a" (the letter before). Now the caption is "aaa", which meets the rule. In total, you need 2 changes to meet the rule, which is the minimum possible. Thus the answer is 2.
- caption = "abcdef"
- Output is 3.
Specific question not provided.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.