← Citi Interview Insights

Citi·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Citi software engineer interview that leaned pretty heavily on CS fundamentals. The questions were textbook but they pushed for specifics on complexity and tradeoffs, not just surface-level definitions.

Questions Asked (3)

Q1

Walk me through how a hash map works under the hood, including how collisions are handled, what load factor means, and how resizing works. What are the average and worst-case time complexities for search, insert, and delete?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is the question I thought I had cold and then fumbled the worst-case part.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining a hash map as an array of buckets that uses a hash function to map keys to indices, then explain collision resolution strategies like chaining and open addressing. Describe load factor and resizing, and conclude with time complexities, emphasizing average O(1) and worst-case O(n) due to collisions.

Pro tip: Mention that Java's HashMap uses a load factor of 0.75 and converts buckets to red-black trees when they exceed a threshold, improving worst-case performance to O(log n). This shows practical knowledge beyond textbook theory.

1. Core Structure

Explain that a hash map stores key-value pairs in an array of buckets, using a hash function to compute an index for each key.

2. Collision Handling

Describe common collision resolution techniques: separate chaining (linked lists or trees per bucket) and open addressing (linear/quadratic probing, double hashing).

3. Load Factor and Resizing

Define load factor as the ratio of stored entries to bucket count, and explain that when it exceeds a threshold (e.g., 0.75), the map resizes (typically doubles) and rehashes all entries.

4. Time Complexities

State that average-case search, insert, and delete are O(1), while worst-case is O(n) due to collisions, or O(log n) with tree-based buckets.

Key Points to Mention

  • Hash function and index computation (e.g., hashCode() and modulo or bitwise AND)
  • Separate chaining vs. open addressing
  • Load factor definition and typical threshold (0.75)
  • Resizing process: allocate larger array, rehash all entries
  • Average O(1) time complexity for search, insert, delete
  • Worst-case O(n) or O(log n) with balanced trees

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What are the tradeoffs between arrays and linked lists, specifically around random access and insertion performance?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Pretty quick exchange.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the core structural differences between arrays and linked lists, then contrast their performance for random access and insertion. Use Big-O notation to quantify tradeoffs and mention real-world scenarios where each excels.

Pro tip: Mention that modern hardware and language implementations (e.g., dynamic arrays, cache-friendly designs) often blur the theoretical tradeoffs, showing you understand practical engineering beyond textbook answers.

1. Define the structures

Briefly describe arrays as contiguous memory blocks and linked lists as nodes with pointers. This sets the foundation for performance differences.

2. Analyze random access

Explain that arrays offer O(1) random access via index calculation, while linked lists require O(n) traversal from the head. Mention that this makes arrays preferable for read-heavy, index-based operations.

3. Analyze insertion performance

Discuss that linked lists allow O(1) insertion/deletion at a known position (given a pointer), whereas arrays require O(n) shifting for insertions in the middle. Note that appending to a dynamic array is amortized O(1).

4. Consider memory and cache

Highlight that arrays have better cache locality and lower memory overhead, while linked lists incur pointer overhead and poor cache performance. This often makes arrays faster in practice despite theoretical tradeoffs.

5. Summarize with use cases

Conclude by recommending arrays for frequent random access and iteration, and linked lists for frequent insertions/deletions at arbitrary positions, especially when the size is unpredictable.

Key Points to Mention

  • Big-O notation for access: O(1) for arrays vs O(n) for linked lists
  • Insertion complexity: O(n) for arrays (due to shifting) vs O(1) for linked lists (with pointer)
  • Memory overhead: arrays have contiguous allocation, linked lists have extra pointer storage
  • Cache locality: arrays are cache-friendly, linked lists cause cache misses
  • Dynamic arrays: amortized O(1) append but occasional resizing cost
  • Real-world examples: arrays for databases/indexes, linked lists for queues/stacks

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

When would you use a stack versus a queue? What are the time complexities for their core operations?

Algorithms & Data Structures
Author's notes

Gave the standard answers: stack for things like undo history or call stacks, queue for task scheduling or BFS.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both data structures and their core operations, then contrast their access patterns (LIFO vs FIFO) and typical use cases. Finally, state the time complexities for core operations, noting that both offer O(1) for push/pop or enqueue/dequeue in optimal implementations.

Pro tip: Mention that while both have O(1) core operations, the choice often depends on the problem's access pattern and that in interviews, you should also discuss edge cases like empty structures and potential memory considerations.

1. Define Stack and Queue

Clearly state that a stack is LIFO (Last-In-First-Out) and a queue is FIFO (First-In-First-Out), and describe their core operations: push/pop for stack, enqueue/dequeue for queue.

2. Explain Use Cases

Provide scenarios where each is appropriate: stacks for function call management, undo mechanisms, expression evaluation; queues for task scheduling, breadth-first search, and handling asynchronous data.

3. State Time Complexities

Specify that both stacks and queues have O(1) time complexity for their core operations (push/pop, enqueue/dequeue) when implemented with linked lists or dynamic arrays.

4. Discuss Implementation Trade-offs

Briefly mention that while both can be implemented with arrays or linked lists, the choice may affect performance in terms of resizing, memory overhead, and cache locality.

5. Summarize and Conclude

Reiterate that the choice depends on the required order of processing and that both are efficient for their intended operations.

Key Points to Mention

  • LIFO vs FIFO access patterns
  • Core operations: push, pop, enqueue, dequeue
  • Time complexity: O(1) for core operations
  • Use cases: stacks for recursion/undo, queues for scheduling/BFS
  • Implementation options: arrays vs linked lists
  • Edge cases: empty structure operations, overflow/underflow

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.