Bloomberg | Phone screen | First unique element & Flatten linked list
Anonymous User
6032

The entire interview was done over a online code editor. It took less than an hour total, including the questions I had for my interviewer.

  • Behavioral questions
    • Tell me about your background.
    • Tell me about a framework you learned recently.
  • Technical questions
  1. Find the first unique element in an array of unique and duplicate elements.

Initially used a counter hash to count all the elements and do another pass and return the first unique element (O(n) time/space).

Then they asked me to do it without a counter hash so I used a hash keeping the indices and updating the key/value pair as I hit them (Still O(n) time/space).

I did mention using XOR for duplicate elements occuring at most twice/even numbers and sorting the array and returning the first element that doesn't repeat (O(1) space but O(n) and O(nlogn) time respectively).

  1. https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/

Except singly-linked but done the same way. Used recursion initially returning the tail instead of the head but switched to using a stack once I realized it was just a simple dfs traversal on a binary tree.

Comments (6)