FastPrepBest Telescope Site
Problems/Best Telescope Site

Best Telescope Site

Atlassian logoAtlassian● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The text, the screenshots, and the shared code all agree on the shortest-path threshold and on picking the higher number in a tie. Our version is about 99% the same as the reported question.

There are cityNodes cities numbered from 1 to cityNodes. The arrays cityFrom, cityTo, and cityWeight describe weighted bidirectional edges of a connected graph.

For each city, count the other cities whose shortest-path distance is at most distanceThreshold. Return the city with the smallest count. If several cities tie, return the highest city number.

Function

bestTelescopeSite(cityNodes: int, cityFrom: int[], cityTo: int[], cityWeight: int[], distanceThreshold: int) → int

Examples

Example 1

cityNodes = 3cityFrom = [1,2]cityTo = [2,3]cityWeight = [3,1]distanceThreshold = 3return = 3

Cities 1 and 3 each reach one other city within the threshold; the higher-numbered city 3 wins the tie.

Constraints

  • 2 <= cityNodes <= 100
  • 1 <= cityFrom.length <= 10000
  • 1 <= cityWeight[i], distanceThreshold <= 10^9
  • The graph is connected.

More Atlassian Online Assessment questions

  • Planning ProductionOA · Seen Feb 2025
  • K-Means ClusteringOA · Seen Feb 2025
  • Minimum Sorted Erasure OperationsOA · Seen Jun 2024
  • Count Analogous ArraysOA · Seen Mar 2024
  • Get Maximum ScoreOA · Seen Mar 2024
  • Better Compression 🦀OA · Seen Mar 2024
  • Romanizer 🐡OA · Seen Mar 2024
  • Flower Bouquets 💐OA · Seen Mar 2024
  • Binary Search Tree IteratorOA · Seen Nov 2023
  • Binary Tree Level Order TraversalOA · Seen Nov 2023

Similar questions at other companies

  • Sum Dynamic Weighted Tree DistancesJuspay · OA
  • Minimum Fuel Cost Between CitiesMicrosoft · OAMicrosoft interview questions
  • Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
  • Optimal TransferSuperhuman · OASuperhuman interview questions
  • Minimum Travel Time With Periodic Fast RoadsAdobe · OAAdobe interview questions
  • Find the PathLinkedIn · OALinkedIn interview questions
  • Energy CrisisRubrik · OARubrik interview questions
  • Compute Number of LocationsMoney Forward · OA
  • Cheapest Flight with Its PathAirbnb · OA · ONSITE INTERVIEWAirbnb interview questions
  • Traveling the GraphsOptiver · OAOptiver interview questions

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public int bestTelescopeSite(int cityNodes, int[] cityFrom, int[] cityTo, int[] cityWeight, int distanceThreshold) {
      // Write your code here.
    }

}
Checking account…