FastPrepCount Distinct Message Mentions
Problems/Count Distinct Message Mentions

Count Distinct Message Mentions

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter new-grad OA reports describe @ groups, comma-separated IDs, removing duplicates within each message, members with a count of zero, and output sorted by count descending and then ID ascending. We supplied a whitespace tokenization rule and a function signature.

Given member IDs and messages, a mention group is a whitespace-delimited token beginning with @; its remainder may contain comma-separated IDs.

Count each member at most once per message, ignore unknown or unprefixed IDs, and include zero-count members. Return id=count strings sorted by count descending, then ID ascending.

Function

countMemberMentions(members: String[], messages: String[]) → String[]

Examples

Example 1

members = ["id1","id2","id8"]messages = ["@id1 @id8,id8","hello @id8"]return = ["id8=2","id1=1","id2=0"]

id8 is counted once in each message despite its duplicate first-message mention.

Example 2

members = ["a","b"]messages = ["a @b"]return = ["b=1","a=0"]

The unprefixed a is ignored.

Constraints

  • 1 <= members.length,messages.length <= 100000
  • Member IDs contain letters and digits and contain no commas or spaces.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Decode Words with Anagram KeysCresta · OACresta interview questions
  • Longest String ChainVisa · OAVisa interview questions
  • Frequently Bought TogetherAmazon · OA
  • Maximize Palindromic WordsSquarepoint Capital · OASquarepoint Capital interview questions
  • Aggregate Paginated Project Run RecordsReplit · OA
  • Parse and Filter Chargeback DisputesStripe · OAStripe interview questions
  • Count User Logins 🌿 (Singapore)PayPal · OAPayPal interview questions
  • Largest Lexicographical Substring 🌿Google · OAGoogle interview questions
  • Rank Common Translation MistakesDuolingo · OADuolingo interview questions
  • Aggregate Investment Ownership from CSVCarta · OA · PHONE SCREEN

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String[] countMemberMentions(String[] members, String[] messages) {
        // Write your code here.
    }

}
Checking account…