FastPrepChunked Byte Stream Checksums
Problems/Chunked Byte Stream Checksums

Chunked Byte Stream Checksums

Upstart logoUpstart● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report describes a byte stream where header bytes mark the checksum chunks. It leaves out the checksum formula and the exact header rules. Our version uses a byte-sum checksum with limits, as described below. It is about 68% the same as the reported question.

An integer array stream encodes consecutive chunks. Each chunk starts with one header byte k, followed by exactly k data bytes.

For every chunk, compute the unsigned byte-sum checksum:

checksum = (sum of the chunk's data bytes) modulo 256

The header byte is not part of the checksum. Return the checksums in chunk order. A zero-length chunk has checksum 0.

Function

computeChecksums(stream: int[]) → int[]

Examples

Example 1

stream = [3,10,20,30,2,255,2]return = [60,1]

The first chunk sums to 60. The second sums to 257, whose remainder modulo 256 is 1.

Example 2

stream = [0,1,7,4,100,100,100,100]return = [0,7,144]

The chunks contain zero, one, and four data bytes. The last checksum is 400 modulo 256 = 144.

Constraints

  • 1 <= stream.length <= 10^5.
  • Every value is an integer from 0 through 255.
  • The stream is valid: each header is followed by exactly its declared number of data bytes, and the final chunk ends at the end of the array.

More Upstart Online Assessment questions

  • Buffet Day GainsOA · Seen Sep 2026
  • Case-Insensitive Anagram CheckOA · Seen Sep 2026
  • Filter Duplicates While Preserving OrderOA · Seen Sep 2026
  • Scale Ingredient QuantitiesOA · Seen Sep 2026
  • ABO Parent Genotype CombinationsOA · Seen Aug 2026
  • Cluster Size on DiskOA · Seen Aug 2026
  • Double Substitution DecryptionOA · Seen Aug 2026
  • Add Drama to Text GroupsOA · Seen Jul 2026
  • Lexicographic Word FrequenciesOA · Seen Jul 2026
  • Minimum Absolute Pair DifferenceOA · Seen Jul 2026

Similar questions at other companies

  • Incident MonitorStripe · OAStripe interview questions
  • Bank Requests with Delayed CashbackRamp · OARamp interview questions
  • Format CSV Rows as an ASCII TableAmazon · PHONE SCREEN
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Out-of-Order TLV File ReassemblyApplied Intuition · PHONE SCREENApplied Intuition interview questions
  • Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
  • Layered ASCII Canvas Command ProcessorAsana · ONSITE INTERVIEW
  • Parse Command-Line TokensSamsara · ONSITE INTERVIEWSamsara interview questions
  • Reversible Run-Length EncodingZillow · PHONE SCREENZillow interview questions
  • Exclusive Time of FunctionsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
All Upstart interview questionsSee Upstart hiring insights
Saved
class Solution {
    public int[] computeChecksums(int[] stream) {
        // Write your code here.
    }
}
Checking account…