FastPrepDesign Hit Counter
Problems/Design Hit Counter

Design Hit Counter

Atlassian logoAtlassian● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The report links to the exact Design Hit Counter exercise but does not copy its full statement. Our version takes one finite list of operations, so the same state changes can be checked with a single function.

Process chronological hit and getHits operations. A query returns the number of hits in the inclusive interval from timestamp - 299 through timestamp. Return "null" for a hit and the decimal count for a query.

Function

runHitCounter(operations: String[], timestamps: int[]) → String[]

Examples

Example 1

operations = ["hit","hit","hit","getHits","hit","getHits"]timestamps = [1,2,3,4,300,301]return = ["null","null","null","3","null","3"]

At time 301, the hit at time 1 has expired but the other three remain.

Constraints

  • Operation and timestamp arrays have equal non-zero length.
  • Timestamps are positive and non-decreasing.
  • There are at most 100000 operations.

More Atlassian Online Assessment questions

  • Planning ProductionOA · Seen Feb 2025
  • K-Means ClusteringOA · Seen Feb 2025
  • Minimum Sorted Erasure OperationsOA · Seen Jun 2024
  • Count Analogous ArraysOA · Seen Mar 2024
  • Get Maximum ScoreOA · Seen Mar 2024
  • Better Compression 🦀OA · Seen Mar 2024
  • Romanizer 🐡OA · Seen Mar 2024
  • Flower Bouquets 💐OA · Seen Mar 2024
  • Binary Search Tree IteratorOA · Seen Nov 2023
  • Binary Tree Level Order TraversalOA · Seen Nov 2023

Similar questions at other companies

  • Per-Client Sliding-Window Rate LimiterGeneral Motors · OA
  • Token Expiry with Lazy DeletionCitadel · OACitadel interview questions
  • Per-Domain Request LimiterExpedia · OAExpedia interview questions
  • Customer Checkout DurationOptiver · OAOptiver interview questions
  • Two-Type Ring BufferIMC Trading · OAIMC Trading interview questions
  • Priority Message BufferAmazon · ONSITE INTERVIEW
  • Rate Limiter with a Sliding Window per ClientStackAdapt · PHONE SCREENStackAdapt interview questions
  • Rolling Hit CounterDatabricks · PHONE SCREEN · ONSITE INTERVIEWDatabricks interview questions
  • Design Hit CounterCharta Health · PHONE SCREENCharta Health interview questions
  • Per-Client API Rate LimiterDocker · PHONE SCREEN
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public String[] runHitCounter(String[] operations, int[] timestamps) {
      // Write your code here.
    }

}
Checking account…