Community

Discussion Board

Anonymous interview experiences, offers and career talk from frontend engineers.

anon_141897

Bloomberg - Front end - Phone Screen

Bloomberg · Front end

Rounds

  1. Phone Screen

Questions asked

  • Write a function to group an array into equivalence classes based on a provided equivalence function.
  • Why use hooks? (Because it replaces the class component lifecycle like componentDidMount)
  • useContext vs redux
  • Asked me about GraphQL
  • System design: develop an API
  • Asked about Playwright, mention it works in pipeline too and coverage

Example code for the grouping function:

function groupEquiv(arr, equiv) {
  const groups = [];
  for (let i = 0; i < arr.length; i++) {
    let placed = false;
    for (let g = 0; g < groups.length; g++) {
      if (equiv(arr[i], groups[g][0])) {
        groups[g].push(arr[i]);
        placed = true;
        break;
      }
    }
    if (!placed) {
      groups.push([arr[i]]);
    }
  }
  return groups;
}
const input = [1, 2, 3, 4, 5, 6];
groupEquiv(input, (a, b) => a % 2 === b % 2); // [[1,3,5],[2,4,6]]
groupEquiv(input, (a, b) => a + b === 7);      // [[1,6],[2,5],[3,4]]
groupEquiv(input, (a, b) => a > 3 && b > 3);  // [[1],[2],[3],[4,5,6]]
groupEquiv(input, (a, b) => a === b);          // [[1],[2],[3],[4],[5],[6]]

Tips

  • Be ready to explain your reasoning for using hooks and compare state management options.
  • For grouping logic, Multi-Key Group By on FrontendLead is similar.

No replies yet

Markdown supported. 20 more characters needed.