FastPrepK-Second Message Suppression
Problems/K-Second Message Suppression

K-Second Message Suppression

Microsoft logoMicrosoft● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Microsoft onsite interview. The task gives timestamps, messages, a window you can set, and an output of true and false values. We chose how the timer works after a message goes through, and the limits. Our version is about 96% the same as the reported question.

For each chronological (timestamp, message) pair, return whether the message is accepted. The same message may be accepted again only when at least k seconds have passed since its most recent accepted occurrence.

A suppressed occurrence does not reset the timer.

Function

shouldAcceptMessages(timestamps: int[], messages: String[], k: int) → boolean[]

Examples

Example 1

timestamps = [1,2,3,8,11]messages = ["a","b","a","a","a"]k = 10return = [true,true,false,false,true]

The final a is ten seconds after the first accepted a.

Example 2

timestamps = [1,1]messages = ["x","y"]k = 5return = [true,true]

Different messages are independent.

Constraints

  • The arrays have equal length up to 100000.
  • Timestamps are non-decreasing.
  • 0 <= k <= 10^9.

Source note: Author-written prompt excerpt retained for source fidelity.

More Microsoft Onsite Interview questions

  • Bad Request AlertsONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Valid ParenthesesONSITE INTERVIEW · Seen Nov 2026
  • Count a User's Actions in an Event LogONSITE INTERVIEW · Seen Nov 2026
  • Smallest Batch Size Within a Step LimitONSITE INTERVIEW · Seen Nov 2026
  • Count Subarrays with Equal Even and Odd CountsONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Rot All OrangesONSITE INTERVIEW · Seen Nov 2026
  • Coin ChangeONSITE INTERVIEW · Seen Oct 2026
  • Daily USD Totals with Effective-Dated Exchange RatesONSITE INTERVIEW · Seen Oct 2026
  • Number Words to Digits in Any LanguageONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions
  • Filter Pins by Excluded IDsPinterest · ONSITE INTERVIEWPinterest interview questions
  • Longest Dictionary Word from Nine LettersGoogle · ONSITE INTERVIEWGoogle interview questions
  • Logger Rate LimiterAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Loyal Customers by Two-Day Product VarietyAmazon · ONSITE INTERVIEW
  • Find Nodes with Invalid Parent LevelsZip · ONSITE INTERVIEWZip interview questions
  • Count Word FrequenciesBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Most Voted CandidateExpedia · ONSITE INTERVIEWExpedia interview questions
  • List Each Name Once, AlphabeticallyDocuSign · ONSITE INTERVIEWDocuSign interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public boolean[] shouldAcceptMessages(int[] timestamps, String[] messages, int k) {
        // Write your code here.
    }
}
Checking account…