InterviewDB
Experience
Flip Coins: Compute the Expected Number of Heads After Applying a Sequence of Flip Operations
Interview Experience
Problem You start with n coins all showing tails (0). You perform k operations. Each operation i flips every coin at positions that are multiples of i (1-indexed). After all operations, how many coins show heads? Example: Follow-ups For k >= n, a coin at position p is flipped by every divisor of p up to k. Can you derive a closed-form count without simulating? A coin ends heads if it is flipped an odd number of times. Which numbers have an odd number of divisors? (Perfect squares -- use this ins…
Full Details
🔒
Unlock all Square/Block questions
Full insider details, leaked discussions, and candidate experiences.
or every company, $100/year →About This Question
This is a candidate experience report from a square/block interview.
It covers the following topics: Coding, Data Scientist .