Find occurrence and constraint

Asked at Bloomberg · Coding & Leetcode-style Questions · Difficulty: Easy

Given a string and a character, find all occurrences of this character in the string. Then, add a constraint: if the next character in the position is the specified character "X", then ignore this position in the result. Implement a function that fulfills the requirements and provide the time complexity. Error handling is not required.

Loading the problem…