FastPrepComment Word and Substring Search
Problems/Comment Word and Substring Search

Comment Word and Substring Search

Rippling logoRippling● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An intern report gives only the cohort and not an exact interview date. It asks for comment IDs, whole-word search, and a follow-up on substring search. We chose how to split words, the input order, and the limits. Our version is about 85% the same as the reported question.

You are given parallel arrays commentIds and comments. Each comment has a unique integer ID and a text string. Return the IDs of comments matching the search word.

  • In WORD mode, the query must equal a complete space-delimited word.
  • In SUBSTRING mode, the query may occur inside a longer word.

Text and queries use lowercase English letters; text may also contain spaces. A word is a nonempty group of consecutive letters, bounded by spaces or the start or end of the text. Return each matching ID once, in the same order as the input comments. The collection is fixed for this call.

Function

searchComments(commentIds: int[], comments: String[], word: String, mode: String) → int[]

Examples

Example 1

commentIds = [41,7,20]comments = ["red bird","bluebird red","blue bird"]word = "bird"mode = "WORD"return = [41,20]

Only complete tokens match; bluebird does not.

Example 2

commentIds = [41,7,20]comments = ["red bird","bluebird red","blue bird"]word = "bird"mode = "SUBSTRING"return = [41,7,20]

The substring follow-up also matches bluebird.

Example 3

commentIds = [8,3]comments = ["green green","blue"]word = "green"mode = "WORD"return = [8]

Repeated occurrences in one comment still produce one ID.

Constraints

  • 0 <= commentIds.length = comments.length <= 1000.
  • Comment IDs are unique integers between 0 and 10^9.
  • The total number of text characters is at most 10^5.
  • 1 <= word.length <= 100.
  • Texts contain lowercase English letters and spaces; the query contains lowercase English letters only.
  • mode is WORD or SUBSTRING.

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
  • Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
  • Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
  • Group AnagramsWorkday · PHONE SCREEN
  • Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
  • Elevator Scheduling SimulationOpenAI · PHONE SCREENOpenAI interview questions
  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW

Interview reports that mention this question

  • Rippling No-Level Coding Screens: 37 Experiences (Part 3 of 6)
  • Rippling SWE Interviews, No Level: 156 Experiences (Part 1 of 6)
  • Rippling Intern Onsite Interviews: 18 Experiences (Part 4 of 5)
  • Rippling SWE Intern Interviews: 101 Experiences (Part 1 of 5)

Rippling interview experiences

  • Rippling Senior SWE Full Loop Questions: 1 Experience
  • Rippling Experienced SWE Phone Screens: 2 Experiences
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int[] searchComments(int[] commentIds, String[] comments, String word, String mode) {
        // Write your code here.
    }

}
Checking account…