Xai

Xai Software Engineer Interview Questions

18+ questions from real Xai Software Engineer interviews, reported by candidates.

18
Questions
1
Round Types
6
Topic Areas
2025
Year Range

Round Types

Onsite 5

Top Topics

Questions

This post was last edited by Anonymous on 2025-10-02 12:50 This company places great emphasis on coding. Coding 1: A slight variation of LRU, where each item carries a quantity, so when calculating th

This post was last edited by Anonymous on 2025-10-7 17:31. Just finished the xAI onsite interview today. The coding wasn't particularly difficult, but it was very demanding. I had to solve the problem

Distributed Rate Limiter ## Problem Summary Your goal is to build a **distributed rate limiter**. This system limits how many requests a user can make in a certain time period. You will use the "Tok

Weighted LRU Cache ## The Challenge You need to build a **Weighted LRU (Least Recently Used) Cache**. This is different from a normal LRU cache. In a normal cache, you just count how many items are

Transactional Key-Value Store ## The Challenge You need to build an **in-memory key-value store** that supports transactions. This includes **nested transactions**. This setup is often used in datab

Sorting an Array Using Multiple Threads ## The Goal You have a big list (array) of integers. You need to write a function that sorts this list. To make it faster, you must use multiple threads. ```p

Designing a Rate Limiter with Custom User Limits ## The Requirement We need to build a rate limiting system. In this system, **every user gets a specific token quota**. Standard rate limiters usuall

Durable Key-Value Cache ## Problem Requirements The goal is to build a **durable key-value cache**. This means the cache must save its data to a storage drive (like a hard disk). If the program cras

Radix Cache ## Problem Summary You need to build a **Prefix Radix Cache**. This data structure saves lists (sequences) of numbers efficiently using a "radix tree." A normal trie stores one number pe

Design a Distributed Key-Value Store ## The Challenge Your task is to design a **distributed key-value store**. This is a very common question in system design interviews. It tests how well you unde

Twitter Spaces Active Time ## Problem Summary Twitter Spaces allows users to talk in live audio rooms. Users can start a room, join one, or leave. You have a list of these actions (logs). You need t

Problem Overview You are provided with a list of integers called `nums` and a single integer `k`. For every number in the list, you are allowed to do one specific action exactly one time: * Add a va

Design a Push Notification System for New Posts Design a notification system that sends push notifications to followers when an author publishes a new post. Followers may have multiple devices, can

Nested Structure Flatten and Unflatten ## Problem Overview Many production pipelines need to transform hierarchical data into a linear representation and then reconstruct the original shape later. T

## Problem Given the root of a binary tree, a node is "bad" if its value does not lie within the range `[min_val, max_val]` inherited from its ancestors (similar to BST validity). Remove all bad nodes and their subtrees. Return the modified root. ```python class TreeNode: def __init__(self, val=0, left=None, right=None): ... def remove_bad_nodes( root: TreeNode, min_val: int = float('-inf'), max_val: int = float('inf') ) -> TreeNode | None: pass ``` **Example:** ``` Tree: 5 / \ 1 8 / \ 0 3 Range enforced: left child must be < parent, right child must be > parent Node 8 is bad if 8 > 5 is allowed, but 0 < 1 left of 5... walk through your definition. Output: cleaned tree with only valid-range nodes remaining. ``` ## Follow-ups 1. How does the valid range narrow as you traverse left vs. right? 2. What is the time complexity? Can you do this iteratively? 3. If a bad node has valid children, should the children be re-attached? Why or why not? 4. How would you extend this to an N-ary tree where each child has a specific position constraint?

## Problem Design a durable (persistent) cache that survives process restarts, combining in-memory speed with disk-backed durability. ## Likely LeetCode equivalent No confident LC match. ## Tags hash_table, design, xai, cache

## Problem Build a `DynamicBatcher` that collects incoming requests and flushes them as a batch either when the batch reaches `max_size` items or after `max_wait_ms` milliseconds since the first request in the batch arrived — whichever comes first. ```python class DynamicBatcher: def __init__(self, max_size: int, max_wait_ms: int, process_batch: Callable[[list], list]): ... def submit(self, request: dict) -> Future: """ Returns a Future that resolves when the batch containing this request has been processed. """ ``` **Example behavior:** ``` batcher = DynamicBatcher(max_size=10, max_wait_ms=50, process_batch=db_bulk_insert) f1 = batcher.submit({"id": 1, "data": "..."}) f2 = batcher.submit({"id": 2, "data": "..."}) # If 8 more arrive within 50ms -> all 10 flushed together # If timeout hits first -> flush whatever is pending ``` ## Follow-ups 1. How do you associate each request's Future with its position in the batch result list? 2. What threading model do you use — a background flusher thread, asyncio, or something else? 3. How do you handle partial batch failures where some items succeed and others fail? 4. If the process_batch function is slow and requests pile up, how do you add backpressure?

## Problem Design a real-time audio broadcasting system (similar to Twitter Spaces) handling large concurrent audiences. ## Likely LeetCode equivalent No LC equivalent; system design question. ## Tags system_design, xai, real_time, audio

See All 18 Xai Software Engineer Questions

Full question text, answer context, and frequency data for subscribers.

Get Access