PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Software Engineering Fundamentals/Citadel

Design a Thread-Safe Shared Counter

Last updated: May 23, 2026

Quick Overview

This question evaluates understanding of concurrency, synchronization, shared-state management, and inter-process coordination by asking for a thread-safe per-key counter implementation in the Software Engineering Fundamentals domain.

  • medium
  • Citadel
  • Software Engineering Fundamentals
  • Software Engineer

Design a Thread-Safe Shared Counter

Company: Citadel

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Design and implement a per-key counter. Requirements: - Provide an API such as `incrementAndGet(key)`. - Each call increments the count for that key and returns how many times that key has been called so far. - Start with a simple in-process implementation. - Make the implementation thread-safe. - Compare multiple thread-safety approaches and their trade-offs. - Extend the design to support multiple independent applications or processes running on the same host that all need to share the same counter values.

Quick Answer: This question evaluates understanding of concurrency, synchronization, shared-state management, and inter-process coordination by asking for a thread-safe per-key counter implementation in the Software Engineering Fundamentals domain.

Citadel logo
Citadel
Mar 7, 2026, 12:00 AM
Software Engineer
Technical Screen
Software Engineering Fundamentals
0
0

Design and implement a per-key counter.

Requirements:

  • Provide an API such as incrementAndGet(key) .
  • Each call increments the count for that key and returns how many times that key has been called so far.
  • Start with a simple in-process implementation.
  • Make the implementation thread-safe.
  • Compare multiple thread-safety approaches and their trade-offs.
  • Extend the design to support multiple independent applications or processes running on the same host that all need to share the same counter values.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Citadel•More Software Engineer•Citadel Software Engineer•Citadel Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.