FastPrepLongest Transfer Time in a Server Tree
Problems/Longest Transfer Time in a Server Tree

Longest Transfer Time in a Server Tree

Rippling logoRippling● MediumNEW GRADFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two Rippling SDE-1 online-assessment reports from early 2025 include this task. One frames it as a tree of servers where every link takes the same time, and wants the slowest possible transfer in the whole network. The other gives only a one-line name for a longest-route task on a general graph.

The reports give no limits, and the second does not say the graph is a tree. Here the network is always a tree with servers numbered 1 to serverCount, the links come as one list of pairs, a single server gives 0, and the limits and examples are our own.

Our version is about 90% the same as the reported questions.

A company runs serverCount servers numbered from 1 to serverCount. They are joined by serverCount - 1 two-way links, where links[i] = [a, b] connects server a and server b. Every server can reach every other server, so the network is a tree: there is exactly one route between any two servers.

Sending data across one link takes 1 unit of time, so sending data from one server to another takes as many units as there are links on the route between them.

Return the longest time needed to send data between any two servers. If there is only one server, return 0.

Function

longestTransferTime(serverCount: int, links: int[][]) → int

Examples

Example 1

serverCount = 6links = [[1,2],[1,3],[3,4],[3,5],[5,6]]return = 4

The longest route is 2 → 1 → 3 → 5 → 6. It uses 4 links, so it takes 4 units of time. No other pair of servers is farther apart; for example, 4 → 3 → 5 → 6 uses only 3 links.

Example 2

serverCount = 7links = [[4,1],[4,2],[2,3],[4,5],[5,6],[6,7]]return = 5

The longest route is 3 → 2 → 4 → 5 → 6 → 7, which uses 5 links. Server 1 is not on it: the farthest server from server 1 is server 7, only 4 links away.

Example 3

serverCount = 1links = []return = 0

There is only one server and no link, so the longest transfer time is 0.

Constraints

  • 1 <= serverCount <= 5000
  • links.length == serverCount - 1
  • links[i].length == 2
  • 1 <= links[i][0], links[i][1] <= serverCount
  • links[i][0] != links[i][1], and together the links connect all servers (so there is no repeated link and no cycle).

More Rippling Online Assessment questions

  • Most Segments That Sort the ArrayOA · Seen Nov 2026
  • Palindromic Paths to the RootOA · Seen Nov 2026
  • Server InvestmentOA · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • REST API: Highest International StudentsOA · Seen Sep 2026
  • Token ValidationOA · Seen Sep 2026
  • Consistent LogsOA · Seen Sep 2026
  • Costliest ChocolateOA · Seen Sep 2026
  • Server ManagementOA · Seen Sep 2026
  • Cyber Beacon DetectionOA · Seen Aug 2026

Similar questions at other companies

  • Maximum Data Transfer TimeMicrosoft · OAMicrosoft interview questions
  • Special Diameter EndpointsAgoda · OAAgoda interview questions
  • Diameter of an Acyclic Undirected GraphSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • All Nodes Distance K in a Binary TreeAmazon · PHONE SCREEN
  • Tree DiameterQualcomm · PHONE SCREENQualcomm interview questions
  • Frog Position After T SecondsInMobi · PHONE SCREENInMobi interview questions
  • Part 1: The Narrowest KeyScale AI · OAScale AI interview questions
  • Tree Pythagorean TriplesIBM · OAIBM interview questions
  • Minimum Cleaning Robot RunsHSBC · OAHSBC interview questions
  • Count Islands with DFS and BFSVisa · OAVisa interview questions

Interview reports that mention this question

  • Rippling SWE Interviews, No Level: 156 Experiences (Part 1 of 6)
  • Rippling New Grad SDE Interviews: 11 Experiences

Rippling interview experiences

  • Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)
  • Rippling No-Level Onsite Loops: 24 Experiences (Part 5 of 6)
  • Rippling No-Level Screens and Loops: 18 Experiences (Part 4 of 6)
  • Rippling No-Level Coding Screens: 37 Experiences (Part 3 of 6)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int longestTransferTime(int serverCount, int[][] links) {
        // Write your code here.
    }
}
Checking account…