FastPrepFirst Eligible Partner in a Social Graph
Problems/First Eligible Partner in a Social Graph

First Eligible Partner in a Social Graph

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report preserves an easy social-graph task whose action is to find the first qualifying partner but omits the qualification predicate and exact meaning of first. The practice version supplies eligibility flags and defines first as nearest by hops with an ID tie-break, matching the reported core at about 75%.

Given an undirected social graph of n people, return the eligible person you can reach from start in the fewest hops. A hop is one move along a link. People are numbered 0 through n - 1, and each row [u, v] in edges is one social link. In the array eligible, eligible[i] == 1 means person i counts as an eligible partner.

start is never their own partner. If several eligible people are equally close, return the smaller person ID. Return -1 if no eligible partner can be reached.

Function

findFirstEligiblePartner(n: int, edges: int[][], start: int, eligible: int[]) → int

Examples

Example 1

n = 6edges = [[0,1],[0,2],[1,3],[2,4],[3,5]]start = 0eligible = [0,0,0,1,1,1]return = 3

People 3 and 4 are both two hops away. The smaller ID, 3, wins the tie.

Example 2

n = 4edges = [[0,1]]start = 0eligible = [1,0,1,0]return = -1

The starting person is excluded, and the only other eligible person is disconnected.

Example 3

n = 5edges = [[0,4],[0,2],[4,3]]start = 0eligible = [0,0,1,0,1]return = 2

People 2 and 4 are each one hop away, so the smaller ID is returned.

Constraints

  • 1 <= n <= 100000.
  • 0 <= edges.length <= 200000.
  • Every edge joins two different valid person IDs.
  • Edges are unique and undirected.
  • eligible.length == n and every value is 0 or 1.
  • 0 <= start < n.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Detonate the Maximum BombsZomato / Eternal · PHONE SCREENZomato / Eternal interview questions
  • Minimize CommuteDatabricks · OA · PHONE SCREENDatabricks interview questions
  • Shortest Word Chain Between Two WordsFanatics · PHONE SCREEN
  • Course ScheduleByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Merge Accounts by Shared AttributeAmazon · PHONE SCREEN
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Shortest Pin Path Through TopicsPinterest · PHONE SCREENPinterest interview questions
  • Shortest Travel Time in a Grid with Traffic LightsWaymo · PHONE SCREENWaymo interview questions
  • Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
  • Evaluate DivisionApple · PHONE SCREENApple interview questions

Interview reports that mention this question

  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
  • Bloomberg New Grad SWE Offer Loops: 14 Experiences (Part 2 of 5)
  • Bloomberg New Grad SWE Interviews: 98 Experiences (Part 1 of 5)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int findFirstEligiblePartner(int n, int[][] edges, int start, int[] eligible) {
        // Write your code here.
    }

}
Checking account…