Kill Process
Updated
Problem statement
pid[i] is a process ID and ppid[i] is its parent ID; parent ID 0 denotes a root.
Killing process kill also kills every descendant. Return all killed process IDs in ascending order.
Function
killProcess(pid: int[], ppid: int[], kill: int) → int[]Examples
Example 1
pid = [1,3,10,5]ppid = [3,0,5,3]kill = 5return = [5,10]Process 10 is a child of 5.
Example 2
pid = [1,2,3]ppid = [0,1,1]kill = 1return = [1,2,3]Killing the root kills both children.
Constraints
pid.length == ppid.length.- Process IDs are unique and relationships form a forest.
killappears inpid.
More Bloomberg LP Onsite Interview questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Delete Nodes and Return Forest RootsGoogle · ONSITE INTERVIEWGoogle interview questions
- Group Identical Tree LevelsSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Bottom View of a Binary TreeOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
- Vertical Order Traversal of a Binary TreeAmazon · ONSITE INTERVIEW
- Binary Tree Vertical Order with Stable TiesMeta · ONSITE INTERVIEWMeta interview questions
- Top View of a Binary TreeInMobi · ONSITE INTERVIEWInMobi interview questions
- Count LevelsBlackRock · OABlackRock interview questions
- Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions
- Everyone Under a ManagerAdobe · PHONE SCREENAdobe interview questions
- Team Cost Under a ManagerRippling · PHONE SCREENRippling interview questions
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
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)