Bytedance New Grad Data Scientist Interview Experience — Four HackerRank OA Questions, Cleared in One Pass

Bytedance·Data Scientist·Mar 2026
Online AssessmentNew Gradeasy

TikTok (ByteDance) 2026 new-grad OA on HackerRank, four questions, cleared all of them in one pass.

Q1: Given a string, ignoring case, count how many positions have s[i] != s[i+1]. Just walk through it once.

Q2: Simulate addition — for each digit, add the digit's contribution directly into the answer. Straightforward simulation, that's all it takes.

Q3: Given a 0/1 array, you need to support two operations: alloc x and erase id. For alloc, scan left to right for the first run of x consecutive 0s whose starting index is a multiple of 8, then set that whole run to 1 and assign it all to that id. For erase, zero out everything equal to that id — if the id doesn't exist, or has already been erased, return -1. I kept two arrays: the original 0/1 array, and a second array t that records where each id's block is. For alloc, brute-force the candidate starts 0, 8, 16, ..., k*8, then check whether the next x cells are all 0 — if so, set that whole segment to the current id. For erase, just scan through in order and clear anything matching. That's the whole thing.

Q4: Every time you add a point, report how many contiguous segments there are, where a segment is a run of same-colored points. I kept a map tracking the colors on either side of each point — when you add or change a point, check whether its color now differs from or matches its neighbors, and update the segment count from there. Just simulate it.

Published

Curated and edited by PracHub

Practice the questions from this interview

Discussion

Sign in to join the discussion. The author is notified of every comment.

Loading comments…

Interview at a glance

Company
Bytedance
Role
Data Scientist
Level
New Grad
Rounds
Online Assessment
Difficulty
easy
Interview date
Mar 2026
Questions from this interview
1 question

Real Bytedance interview experiences

First-hand reports from Bytedance candidates — the rounds, the questions they were asked, and how it went.

All 32 Bytedance interview experiences