Unique Difference Pattern
Updated
Problem statement
You are given a list of strings containing only uppercase English letters.
All strings in the list have the same length.
For each string, calculate the difference between adjacent letters based on their alphabetical positions.
- For example,
'B' - 'A' = 1,'C' - 'A' = 2. - These differences form a difference pattern for the string.
- In the list, all strings except one share the same difference pattern.
Identify and return the string with the unique difference pattern.
Function
findUniqueDifferencePattern(series: String[]) → StringExamples
Example 1
series = ["ACB", "BDC", "CED", "DEF"]return = "DEF"Calculate the differences between adjacent letters:
"ACB":(C - A, B - C) = (+2, -1)"BDC":(D - B, C - D) = (+2, -1)"CED":(E - C, D - E) = (+2, -1)"DEF":(E - D, F - E) = (+1, +1)
The first three strings have the same difference pattern (+2, -1), while "DEF" has a different pattern (+1, +1).
Constraints
3 <= size of series[] <= 262 <= length of series[i] <= 26- All strings are uppercase English letters only.
- Within a test case, all strings are of equal length.
More Microsoft Online Assessment questions
- Minimum Cost to Process Priority TasksOA · Seen Nov 2026
- Most Visited Sprint MarkerOA · Seen Nov 2026
- Maximum Escape Game ScoreOA · Seen Nov 2026
- Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
- Maximum Interactive Team SizeOA · Seen Nov 2026
- Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
- Minimum Cost K-Capable ModelsOA · Seen Nov 2026
- Find Available Meeting RoomsOA · Seen Oct 2026
- Maximum Sum of a K-StarOA · Seen Oct 2026
- Capacity to Ship Packages Within DaysOA · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
- Customer Signer ScreeningState Farm · OA
- String-Pair Frequency SimilarityIBM · OAIBM interview questions
- Number-Character Bijective MappingAdobe · OAAdobe interview questions
- Filter Transaction Logs and Calculate Reliability MetricsStripe · OAStripe interview questions
- Nonzero Totals by NameEPAM · OAEPAM interview questions
- Palindrome-Rearrangeable PairsExpedia · OAExpedia interview questions
- Count Sales Rung Up at the Wrong PriceDocuSign · OADocuSign interview questions
Microsoft interview experiences
- Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
- Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
- Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
- Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
- Microsoft SWE Intern, Early 2026: 54 Experiences (Part 2 of 6)
- Microsoft SWE Intern Interviews: 244 Experiences (Part 1 of 6)