FastPrepPipe Removal Turns
Problems/Pipe Removal Turns

Pipe Removal Turns

Wells Fargo logoWells Fargo● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The images in the report give the full removal process, the limits, and an example. Our version is about 100% the same as the reported question.

Pipes are arranged from left to right, and lengths[i] is the length of pipe i.

During each turn, mark every pipe whose length is strictly greater than the pipe immediately to its left. Remove all marked pipes simultaneously.

Repeat until a turn marks no pipes. Return the number of turns in which at least one pipe is removed.

Function

countPipeRemovalTurns(lengths: int[]) → int

Examples

Example 1

lengths = [3,6,9,8]return = 2

Turn 1 removes 6 and 9, leaving [3,8]. Turn 2 removes 8, leaving [3].

Example 2

lengths = [9,7,5,3]return = 0

No pipe is longer than the pipe immediately to its left.

Example 3

lengths = [4,3,7,5,6,4,2]return = 3

The successive stable lists are [4,3,5,4,2], [4,3,4,2], and [4,3,2].

Constraints

  • 2 <= lengths.length <= 10^5.
  • 1 <= lengths[i] <= 10^9.

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

  • Maximize Shipment Order by Sorting One WindowAmazon · OA
  • Most Segments That Sort the ArrayRippling · OARippling interview questions
  • Maximum Sum of HeightsVirtu Financial · OAVirtu Financial interview questions
  • Trapping Rain WaterGoogle · OAGoogle interview questions
  • Alternating Jumps to the Last IndexExpedia · OAExpedia interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Sum of Subarray MinimumsNVIDIA · OANVIDIA interview questions
  • Shopkeeper Final Price SummaryMicrosoft · OAMicrosoft interview questions
  • Nested Recipe Blocks (Game Adaptation)Roblox · OARoblox interview questions
  • Maximum Capped Histogram Area After One RemovalMyntra · OAMyntra 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 int countPipeRemovalTurns(int[] lengths) {
      // write your code here
    }
}
Checking account…