Skip to content

Instantly share code, notes, and snippets.

@mwicks7
mwicks7 / answer.js
Last active April 21, 2023 12:05
Matt Wicks' answer to Sleep Number interview exercise
/**
* Given an array of Person objects, returns the root PersonTreeNode (the CEO).
* @param {Person[]} employees - An array of Person objects representing all the employees of the company.
* @returns {PersonTreeNode} The CEO of the organization.
*/
function generateTree(employees) {
var ceo = null;
const employeeNodes = employees.map(emp => PersonTreeNode(emp));
const getNodeById = (id) => employeeNodes.filter(en => en.person.id === id)[0];

Keybase proof

I hereby claim:

  • I am mwicks7 on github.
  • I am mwicks7 (https://keybase.io/mwicks7) on keybase.
  • I have a public key whose fingerprint is D9AD 317E 4DAB BC14 F59D C9EF 1851 B5BA BC99 CEBA

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mwicks7 on github.
  • I am mwicks7 (https://keybase.io/mwicks7) on keybase.
  • I have a public key ASDpZeZd7uD6ndBXgFMd_VGlV1UI2hOvfiCt-VZQNRqW4Ao

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mwicks7 on github.
  • I am mwicks (https://keybase.io/mwicks) on keybase.
  • I have a public key whose fingerprint is 20B4 AE45 1D43 7620 F87A A255 7246 137F BB51 EBFC

To claim this, I am signing this object: