PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Upstart

Solve Five OA Coding Tasks

Last updated: Jun 8, 2026

Quick Overview

This question evaluates programming fundamentals including string manipulation, sequence and list processing, basic computational geometry, digit-wise arithmetic comparison, and structured text parsing across five small independent tasks.

  • medium
  • Upstart
  • Coding & Algorithms
  • Software Engineer

Solve Five OA Coding Tasks

Company: Upstart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You are given five independent coding tasks. Implement all of the following functions. 1. **Add drama to text** - Input: a string `s`. - A **group** is a maximal contiguous sequence of non-whitespace characters. - Return a new string where every period `'.'` is replaced with an exclamation mark `'!'`, and one additional exclamation mark is appended after each group. - Preserve the original whitespace between groups. - Example: `"hi. there"` becomes `"hi!! there!"`. 2. **Filter and reverse even numbers** - Input: a list of integers `nums`. - Remove all odd numbers. - Return the remaining even numbers in reverse order relative to their original order. - Example: `[1, 2, 3, 4, 6, 5]` returns `[6, 4, 2]`. 3. **Compute a bounding rectangle** - Input: a non-empty list of coordinates, where each coordinate is a two-element list `[x, y]`. - Return a four-element list `[minX, minY, width, height]`, where: - `minX` is the minimum x-coordinate, - `minY` is the minimum y-coordinate, - `width = maxX - minX`, - `height = maxY - minY`. 4. **Find incorrect digit positions in a sum** - Input: three non-negative integers `num1`, `num2`, and `statedSum`. - Compute the correct value `num1 + num2`. - Compare `statedSum` against the correct sum digit by digit from right to left. - Return the zero-based digit indexes where the digits differ. The ones digit has index `0`, the tens digit has index `1`, and so on. - If the numbers have different lengths, treat missing higher-order digits as `0` while comparing until all digits of both numbers have been consumed. - Example: if `num1 = 99`, `num2 = 1`, and `statedSum = 190`, the correct sum is `100`, so the result is `[1]` because only the tens digit differs. 5. **Extract disallowed URLs for bot user agents** - Input: `lines`, a list of strings representing the contents of a text file, one line per string. - The file is similar to a robots file and contains sections. A new section begins when a line starts with the exact prefix `"User-agent:"`. - A section is relevant if its user-agent value, after trimming surrounding spaces, either: - is exactly `"*"`, or - ends with the exact suffix `"Bot"`. - Within every relevant section, collect the URL value after each line that starts with the exact prefix `"Disallow:"`. - Stop considering a section when the next `"User-agent:"` line begins or the file ends. - Return all collected URLs with duplicates removed. Matching is case-sensitive, so `"/A"` and `"/a"` are different URLs. Preserve the order of first occurrence.

Quick Answer: This question evaluates programming fundamentals including string manipulation, sequence and list processing, basic computational geometry, digit-wise arithmetic comparison, and structured text parsing across five small independent tasks.

Related Interview Questions

  • Implement Byte Formatting and Cafeteria Billing - Upstart (medium)
  • Implement Three Assessment Functions - Upstart (medium)
  • Solve Reported OA Coding Problems - Upstart (medium)
  • Decode an anagram sentence using vocabulary constraints - Upstart (medium)
  • Compute buffet revenue with capacity and waiting - Upstart (medium)
Upstart logo
Upstart
Apr 10, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
7
0

You are given five independent coding tasks. Implement all of the following functions.

  1. Add drama to text
    • Input: a string s .
    • A group is a maximal contiguous sequence of non-whitespace characters.
    • Return a new string where every period '.' is replaced with an exclamation mark '!' , and one additional exclamation mark is appended after each group.
    • Preserve the original whitespace between groups.
    • Example: "hi. there" becomes "hi!! there!" .
  2. Filter and reverse even numbers
    • Input: a list of integers nums .
    • Remove all odd numbers.
    • Return the remaining even numbers in reverse order relative to their original order.
    • Example: [1, 2, 3, 4, 6, 5] returns [6, 4, 2] .
  3. Compute a bounding rectangle
    • Input: a non-empty list of coordinates, where each coordinate is a two-element list [x, y] .
    • Return a four-element list [minX, minY, width, height] , where:
      • minX is the minimum x-coordinate,
      • minY is the minimum y-coordinate,
      • width = maxX - minX ,
      • height = maxY - minY .
  4. Find incorrect digit positions in a sum
    • Input: three non-negative integers num1 , num2 , and statedSum .
    • Compute the correct value num1 + num2 .
    • Compare statedSum against the correct sum digit by digit from right to left.
    • Return the zero-based digit indexes where the digits differ. The ones digit has index 0 , the tens digit has index 1 , and so on.
    • If the numbers have different lengths, treat missing higher-order digits as 0 while comparing until all digits of both numbers have been consumed.
    • Example: if num1 = 99 , num2 = 1 , and statedSum = 190 , the correct sum is 100 , so the result is [1] because only the tens digit differs.
  5. Extract disallowed URLs for bot user agents
    • Input: lines , a list of strings representing the contents of a text file, one line per string.
    • The file is similar to a robots file and contains sections. A new section begins when a line starts with the exact prefix "User-agent:" .
    • A section is relevant if its user-agent value, after trimming surrounding spaces, either:
      • is exactly "*" , or
      • ends with the exact suffix "Bot" .
    • Within every relevant section, collect the URL value after each line that starts with the exact prefix "Disallow:" .
    • Stop considering a section when the next "User-agent:" line begins or the file ends.
    • Return all collected URLs with duplicates removed. Matching is case-sensitive, so "/A" and "/a" are different URLs. Preserve the order of first occurrence.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Upstart•More Software Engineer•Upstart Software Engineer•Upstart Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.