Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ446
Page ↗
Q446ArchASIC interview problem

Find the longest unique token run

TechniquesSliding windowLast seenStreamingFrame state
DifficultyMedium
TopicStreaming Algorithms
LanguageSystemVerilog
Requirements5 checkpoints
01

Problem

For each bounded protocol-token frame, report the longest contiguous run containing no repeated token ID, including its inclusive start and end indices.

Example input and output

Use this case to check your interpretation
Input
accepted token frame = [1, 2, 1, 3, 4, 3]
Output
best_start=1; best_end=4; best_length=4; run=[2, 1, 3, 4]
Explanation

The repeated 1 advances the window start to index 1, and the later repeated 3 closes the longest unique run.

02

Requirements (5)

  • Support token IDs 0 to 15 and frame lengths from 1 to 64.
  • Track only accepted tokens; bubbles and downstream backpressure must not change indices.
  • Never move the current window start backward when a repeated token lies before the active window.
  • On equal maximum lengths, keep the run with the earliest start index.
  • Clear or invalidate last-seen state between frames and hold the final result stable.