Goldman Sachs | Associate | Coderpad | Prime Factorisation + Deepest Node in a directed graph
1867

The Coderpad round was the first round.
It was of 1 hour, there were 2 coding questions and were alloted 30 mins time for each.
I was able to solve both.
The interviewer was polite and gave his introduction and then asked for mine.
The questions are as follows:

  1. Find prime factorisation of a number. (Easy)
    a) 26 -> [2,13]
    b) 24 -> [2,2,2,3]
  2. Find the value of the root with the deepest child node but upon clarifying it came up that by deepest he meant the value of the parent(root) which has the highest number of members. If you find multiple roots with same number of nodes, return the one with minimum root node value. The trees formed by joining the children and parent may or may not be connected. (Medium)
    a) every child can have only one parent
    b) a parent can have any number of children.
    Input: [5 -> 6], [3 -> 4] => Ans = 4
    Input: [1 -> 2], [3 -> 4], [5 -> 4] => Ans = 4
    My key take aways:
  • Keep on discussing your thoughts with your interviewer even if you're not sure.
  • Always clarify the problem as they don't tell the problem exactly and expect you to ask doubts.
    P.S.: If you want solution for the above problems, please let me know in the comments.
Comments (4)