ByteDance Software Engineer Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Implement an LRU cache
Problem: LRU Cache Design and implement a data structure that supports an LRU (Least Recently Used) cache with a fixed capacity. Requirements Implemen...
Explain C++ containers, segfaults, and virtual dispatch
Answer the following C++ conceptual questions: 1. C++ standard containers implementation For common C++ standard library containers such as std::...
Compute length of longest increasing subsequence
You are given an integer array nums of length n. A subsequence of nums is a sequence that can be derived from nums by deleting zero or more elements w...
Design system to detect privacy-leak records
You are given a very large database that contains user data (both structured fields and unstructured text such as logs, messages, and documents). The ...
Find kth smallest in sorted 2D matrix
You are given an n x m matrix of integers where each row and each column is sorted in non-decreasing order. You are also given an integer k such that ...
Describe career plan and teamwork approach
Answer the following behavioral questions: 1. Career planning: What are your next 1–3 year career goals, and why are you pursuing this role/team now? ...
Explain DPO and construct its training data
You are working on a project to fine-tune a large language model (LLM) using Direct Preference Optimization (DPO). Answer the following: 1. Conceptual...
Solve pair-counting and account-merging problems
Problem A — Count qualifying products You are given two integer arrays A and B, and an integer T. For each element a in A, count how many elements b i...
Compute maximum path sum in binary tree
Given the root of a binary tree where each node contains an integer value (which may be negative), return the maximum possible sum of values along any...
Explain Java ConcurrentHashMap and queues
An interviewer asks you conceptual questions about Java's concurrency primitives. Explain in detail: 1. How Java's ConcurrentHashMap is implemented in...
Find k-th largest element in array
You are given an unsorted array of integers nums and a positive integer k. Design an efficient algorithm to find the k-th largest element in the array...
Find first and last index of target
You are given an integer array nums sorted in non-decreasing order and an integer target. Return a pair [left, right] where: - left is the index of th...
Maximize min+max of contiguous subarray
You are given an array of n positive integers nums. Find a contiguous subarray that contains at least two elements and maximizes the value: > (minimum...
Find start indices of anagram substrings
You are given two strings: - s: the text string - p: the pattern string Return a list of all starting indices i such that the substring s[i : i + len(...
Compute maximum path sum in a binary tree
You are given the root of a binary tree where each node contains an integer value (which may be positive, zero, or negative). A path in the tree is de...