ByteDance logo

ByteDance Backend Engineer Coding Questions

33 practice questions for ByteDance Backend Engineer interviews

ByteDance backend engineer interviews typically focus on APIs, databases, system design, concurrency, caching, and data structures.

All Roles Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer

No verified questions yet for ByteDance.

coding Hard sliding window #1

1. [OA] Sliding Window — Longest Substring with K Distinct Characters in ByteDance’s social media feed

ByteDance's social media feed often presents users with posts that have various tags. Implement an algorithm that finds the longest substring containing at most k distinct characters.
Problem Statement: Write a function longestSubstring(s: str, k: int) -> int that returns the length of the longest substring containing at most k distinct characters.
- Example 1:
Input: longestSubstring("eceba", 2)
Output: 3
Explanation: The longest substring is "ece".
- Example 2:
Input: longestSubstring("aa", 1)
Output: 2
Explanation: The longest substring is "aa".
Constraints:
- 1 <= s.length <= 10^5
- 0 <= k <= |s|
coding Hard dynamic programming #2

2. [OA] Dynamic Programming — Maximum Product Subarray in ByteDance’s e-commerce catalog

In ByteDance's e-commerce app, we analyze product performances using their price impact over periods. Calculate the maximum product of a contiguous subarray of product prices.
Problem Statement: Write a function maxProduct(nums: List[int]) -> int that returns the maximum product of a contiguous subarray in the given integer array nums.
- Example 1:
Input: maxProduct([2, 3, -2, 4])
Output: 6
Explanation: The maximum product is 2 * 3 = 6.
- Example 2:
Input: maxProduct([-2, 0, -1])
Output: 0
Explanation: The maximum product is 0.
Constraints:
- 1 <= nums.length <= 2 * 10^4
- -100 <= nums[i] <= 100

Related ByteDance Backend Engineer interview prep

Start practicing ByteDance questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free