InterviewLegend

Arrays and Running Sums

Alex Chen55 min readUpdated 197 real interview reports

Twilio's HackerRank assessment often includes an array problem or two, and the clock is tight. The four problems below look different from each other, but each one keeps a small piece of state and updates it once per element as you scan the array.

The set covers running sums, a queue simulation, a prefix-sum count and a small route-cost dynamic program.

Before you write the loop, decide what the state is and what value it starts at. A wrong seed can pass the samples and still fail a hidden case. The usual one is an all-negative array, where a best sum seeded at zero returns zero instead of the largest negative value. The first element is the other case the hidden tests check.

TwilioPremium lesson · Coding round

The 4 Twilio problems are below.

  1. A Premium questionCoding · Easy
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Twilio questions

$49 a year · all 100 companies · cancel anytime

From 197 Twilio reports, forum threads behind logins and write-ups in Chinese.

Had your Twilio interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Twilio interview guide

Know what Twilio asks before you walk in.

31 coding · 3 system design · 18 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.