FastPrepNetwork Formation
Problems/Network Formation

Network Formation

Palantir logoPalantir● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Palantir new grad online assessment. The photographed statement gives the network rules, the limits, and the function to write.

The first two examples come from the report. The third example and the extra tests are our data.

Our version is about 99% the same as the reported question.

The computers in an office are arranged in a fixed order. Their processing speeds are given in speed.

Form as many networks as possible. Each network must use a contiguous range of computers, contain at least minComps computers, and have a total processing speed of at least speedThreshold.

A computer can belong to at most one network. You may leave computers unused, and you cannot change their order.

Return the maximum number of networks. Return 0 if no network can be formed.

Function

maximumNetworks(speed: int[], minComps: int, speedThreshold: long) → int

Examples

Example 1

speed = [5,7,9,12,10,13]minComps = 2speedThreshold = 15return = 2

Use the second through fourth computers for a total speed of 28, then the fifth and sixth for a total of 23. Both networks have at least two computers. Three networks would require three pairs using all six computers, but the first pair has speed 12, below 15. The best count is 2.

Example 2

speed = [3,3,2,5,3,2,4]minComps = 2speedThreshold = 7return = 2

Use the first three computers, with speed 8, and the next two, also with speed 8. The final pair has speed 6 and is not valid. A valid first network cannot end before the third computer. Getting three networks would then force both remaining pairs into separate networks, but the last pair fails the threshold. The best count is 2.

Example 3

speed = [1,1,4,4]minComps = 2speedThreshold = 5return = 1

The first pair has speed 2, so it cannot form a network. A valid network can use the first three computers, with total speed 6. The last computer alone is too short. Two valid networks would require both fixed pairs, so the answer is 1.

Constraints

  • 1 <= speed.length <= 100000.
  • 1 <= speed[i] <= 1000000000.
  • 1 <= minComps <= speed.length.
  • 1 <= speedThreshold <= 100000000000000.

More Palantir Online Assessment questions

  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026
  • Stacked Item and Category DiscountsOA · Seen Nov 2026
  • Minimize Path ValueOA · Seen Sep 2024
  • No Pairs AllowedOA · Seen Sep 2024
  • REST API: Country CodesOA · Seen Feb 2024
  • Swap ParityOA · Seen Feb 2024
  • Freelance Candidate ReviewOA · Seen Nov 2023
  • Benchmarking Tool ReportOA · Seen Sep 2023
  • Count Fit Records Across PagesOA · Seen Sep 2023

Similar questions at other companies

  • Maximum Even-Sum Neighboring PairsDRW · OADRW interview questions
  • Minimize Total Input Cost (for LTMS)Salesforce · OASalesforce interview questions
  • Maximize Protected City PopulationAmazon · OA
  • Maximum Even Subsequence SumExpedia · OAExpedia interview questions
  • Maximum Even-Sum Adjacent Pairs in a Circular ArrayTesla · OATesla interview questions
  • Fewest Fountains to Water the GardenDocuSign · OADocuSign interview questions
  • Minimum Jumps to Reach the EndNutanix · OANutanix interview questions
  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
  • Split Array Largest SumAuxoAI · OA
  • Maximum Income from Asset TradingJefferies · OA

Interview reports that mention this question

  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)

Palantir interview experiences

  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)
  • Palantir FDSE OA and Interviews: 16 Experiences (Part 1 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public int maximumNetworks(int[] speed, int minComps, long speedThreshold) {
        return 0;
    }

}
Checking account…