Reported July 2026
IDFCunion find

Find All People With Secret

Reported by candidates from IDFC's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live IDFC OA. Under 2s to a working solution.
Founder's read

The IDFC OA reported in July 2026 hands you Find All People With Secret, and the input size is the first thing to read. Meetings can be huge, so re-scanning every meeting every time someone learns the secret will time out. The pattern is union-find, grouped by meeting time. If you've got an OA invite and 48 hours, this is the one to know cold. The trick is small but easy to botch under pressure. StealthCoder sits invisibly on your screen as a safety net if you blank during the live assessment, but you should understand why the time grouping matters first.

The problem

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) → int[]

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

Reported by candidates. Source: FastPrep

Pattern and pitfall

Sort meetings by time. Process each group of meetings sharing the same timestamp together. For each group, union the two people in every meeting. Then check each person in that group: if they're not connected to person 0, reset them to their own set. That reset is the whole trick. Without it, a temporary link from a same-time meeting leaks into later times, and people who never actually got the secret get counted. Start by unioning 0 and firstPerson at time 0. At the end, collect everyone whose root matches the root of 0, and return them sorted. Cost is dominated by the sort, so O(m log m) with near-constant union-find operations. The common pitfall is unioning everything globally and never resetting. A BFS per time group works too, but union-find is cleaner. If you freeze on the reset step during the live OA, StealthCoder is the hedge that gets you unstuck.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Find All People With Secret cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass IDFC's OA.

IDFC reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find All People With Secret FAQ

What's the trick in Find All People With Secret?+

Group meetings by time and use union-find within each group. After unioning a group, reset anyone not connected to person 0 back to their own set. That stops a meeting that didn't spread the secret from creating a false link later.

Why can't I just union all meetings in sorted order?+

Because a union from a meeting where nobody knew the secret stays permanent. A later meeting would then appear connected to person 0 through that stale link. Resetting non-secret people after each time group fixes it.

How hard is this really for the IDFC OA?+

It's a hard-tier problem mostly because of the same-time propagation detail. The code is short, about 25 lines. If you know union-find with a reset, it's quick. If you don't, you'll likely write the leaky global version.

Can I use BFS or DFS instead of union-find?+

Yes. For each time group, build a small graph of the meeting participants, then start a search from everyone who already knows the secret. Mark all reached people. It's the same idea, with more bookkeeping than union-find and the same complexity.

How do I prepare in 48 hours?+

Write a basic union-find with path compression, then solve this problem once end to end. Test it on example 2, where person 3 meets 1 and 0 at the same time 3. Make sure 1 and 3 both end up with the secret.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with IDFC.

OA at IDFC?
Invisible during screen share
Get it