FastPrepFind All People With Secret
Problems/Find All People With Secret

Find All People With Secret

IDFC Bank logoIDFC Bank● HardONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem is backed by a real IDFC onsite interview report that linked Find All People With Secret. The report did not restate the function interface, examples, constraints, or output ordering. The core task match is about 95%.

People are labeled from 0 to n - 1. Person 0 initially shares a secret with firstPerson at time 0. Each meeting [x, y, time] allows either participant to share the secret with the other at that time.

Secret sharing is instantaneous, so information may propagate through several meetings that occur at the same time. Return all people who know the secret after every meeting, sorted in ascending order.

Function

findAllPeople(n: int, meetings: int[][], firstPerson: int) → List<Integer>

Examples

Example 1

n = 6meetings = [[1,2,5],[2,3,8],[1,5,10]]firstPerson = 1return = [0,1,2,3,5]

Example 2

n = 4meetings = [[1,2,2],[3,1,3],[0,3,3]]firstPerson = 3return = [0,1,3]

Constraints

  • 2 <= n <= 10^5.
  • 0 <= meetings.length <= 10^5.
  • meetings[i].length == 3.
  • For every meeting [x, y, time]: 0 <= x, y <= n - 1, x != y and 1 <= time <= 10^5.
  • 1 <= firstPerson <= n - 1.

More IDFC Bank problems

  • Employee Free TimeONSITE INTERVIEW · Seen Aug 2026
  • Minimum Cake CutsOA · Seen Jul 2026
  • Smallest Adjacent ConcatenationOA · Seen Jul 2026
All IDFC Bank interview questionsSee IDFC Bank hiring insights
Saved
class Solution {
    public List<Integer> findAllPeople(int n, int[][] meetings, int firstPerson) {
      // write your code here
    }
}
Checking account…