FastPrepNo Pairs Allowed
Problems/No Pairs Allowed

No Pairs Allowed

Palantir logoPalantir● EasyINTERNOA

Updated Jul 2026

QuestionFunctionExamplesConstraints

Problem statement

For each word in a list of words, if any two adjacent characters are equal, change one of them. Determine the minimum number of substitutions so the final string contains no adjacent equal characters.

Function

minimalOperations(words: String[]) → int[]

Complete the function minimalOperations in the editor below.

minimalOperations has the following parameter(s):

  1. string words[n]: an array of strings

Returns

int[n]: each element is the minimum substitutions for words[x]

Examples

Example 1

words = ["add", "boook", "break"]return = [1, 1, 0]
1. add: change one d (1 change) 2. boook: change the middle o (1 change) 3. break: no changes are necessary (0 changes) The return array is [1, 1, 0]

Constraints

1 ≤ n ≤ 100
2 ≤ length of words[x] ≤ 10^5
Each character of words[x] is in the range ascii[a-z]

More Palantir interview questions

  • Balanced Session ManagerPHONE SCREEN · Seen Nov 2026
  • Query Words Within K PositionsPHONE SCREEN · Seen Nov 2026
  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026
  • Stacked Item and Category DiscountsOA · Seen Nov 2026
  • Map and Accumulate Learning QueriesONSITE INTERVIEW · Seen Oct 2026
  • Employees With Shared InterestsPHONE SCREEN · Seen Jul 2025
  • Relational Learning QueriesONSITE INTERVIEW · Seen Apr 2025
  • Find Unmet Users With Shared InterestsONSITE INTERVIEW · Seen Mar 2025
  • Merge a 2048 RowPHONE SCREEN · Seen Jan 2025

Similar questions at other companies

  • Minimum Changes for Distinct Adjacent CharactersHeadlands Technologies · OAHeadlands Technologies interview questions
  • Maximum Ones After K OperationsGoldman Sachs · OAGoldman Sachs interview questions
  • Minimum Operations to Reduce a Transaction LedgerVisa · OAVisa interview questions
  • Prepare NotificationMicrosoft · OAMicrosoft interview questions
  • Largest Number With Even Digit FrequenciesDRW · OADRW interview questions
  • Minimum Replacements for Unequal Adjacent CharactersIBM · OAIBM interview questions
  • Crop Text at a Whole-Word BoundaryAmerican Express · OAAmerican Express interview questions
  • Minimum Flips for Even Binary RunsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Missing WordsVanguard · OAVanguard interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions

Palantir interview experiences

  • Palantir SWE New Grad - Gotham
  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public int[] minimalOperations(String[] words) {
      // write your code here
    }

}
Checking account…