FastPrepMaximum Taxi Earnings
Problems/Maximum Taxi Earnings

Maximum Taxi Earnings

Wells Fargo logoWells Fargo● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the ride model, the profit formula, the compatibility rule, the goal, and the numeric limits, but uses an int signature that can overflow. Our version is about 98% the same as the reported question.

You are given three arrays pickup, drop, and tip describing taxi ride requests. Ride i starts at pickup[i], ends at drop[i], and earns (drop[i] - pickup[i]) + tip[i].

You can complete only one ride at a time. After finishing a ride at position x, you may take another ride whose pickup position is at least x.

Return the maximum total earnings obtainable from a subset of non-overlapping rides.

Function

maxTaxiEarnings(pickup: long[], drop: long[], tip: long[]) → long

Examples

Example 1

pickup = [2,4,5]drop = [5,5,7]tip = [4,1,2]return = 11

Take the ride from 2 to 5 for 7, then the ride from 5 to 7 for 4.

Example 2

pickup = [1,2,3]drop = [2,3,4]tip = [0,0,0]return = 3

All three rides are compatible and each earns 1.

Example 3

pickup = [0]drop = [1000000000000]tip = [100000]return = 1000000100000

The only ride earns its distance plus its tip. This example also shows why 64-bit arithmetic is required.

Constraints

  • 1 <= pickup.length = drop.length = tip.length <= 10^4.
  • 0 <= pickup[i] < drop[i] <= 10^12.
  • 0 <= tip[i] <= 10^5.

More Wells Fargo Online Assessment questions

  • Server Upgrade PlanningOA · Seen Nov 2026
  • Student and Course EnrollmentOA · Seen Nov 2026
  • Bond Interest Summary Above 3%OA · Seen Oct 2026
  • Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
  • Event Statistics AggregatorOA · Seen Sep 2026
  • Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
  • Longest Subsequence That Is a SubstringOA · Seen Jul 2026
  • Overloaded Game Account InventoriesOA · Seen Jul 2026
  • Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
  • Minimum Remaining LengthOA · PHONE SCREEN · Seen Feb 2026

Similar questions at other companies

  • Fill a Time Window with SongsMicrosoft · OAMicrosoft interview questions
  • Maximum Total Length of Non-Overlapping IntervalsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Russian Doll EnvelopesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Profit in Job SchedulingAmazon · PHONE SCREEN
  • Russian Doll EnvelopesInMobi · ONSITE INTERVIEWInMobi interview questions
  • Russian Doll EnvelopesAirbnb · ONSITE INTERVIEWAirbnb interview questions
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
  • Choose ContainersIMC Trading · OAIMC Trading interview questions
  • Minimum Cost to Attend Required CoursesVisa · OAVisa interview questions

Interview reports that mention this question

  • Wells Fargo OA: What It Tests (2026)

Wells Fargo interview experiences

  • Wells Fargo SWE Intern OA and Interview Questions: 18 Experiences
All Wells Fargo interview questionsSee Wells Fargo hiring insights
Saved
class Solution {
    public long maxTaxiEarnings(long[] pickup, long[] drop, long[] tip) {
      // write your code here
    }
}
Checking account…