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…
More Bloomberg interview questions
- Streaming Social-Media Mentions and Aggregation
- Real-time Market Data Distribution System
- Trade Processor with Subscribe / Unsubscribe
- Flatten a Multilevel Doubly Linked List
- Matchsticks to Square Transform
- Train a Next-Word Predictor from Tokenized Sentences