Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Longhorn PHP 2021 - Passing the Technical Interview Workshop

Ben Edmunds
October 14, 2021
76

Longhorn PHP 2021 - Passing the Technical Interview Workshop

Ben Edmunds

October 14, 2021
Tweet

Transcript

  1. passing the
    Technical
    Interview
    🛠 workshop

    View full-size slide

  2. Who is this guy?
    Ben Edmunds
    Open Source
    Author
    PHP Town Hall Podcast
    More Than Code Podcast
    Sr Staff Eng @ Wayfair

    View full-size slide

  3. Will Cover
    Technical interview process
    from Phone Screen to Offer

    View full-size slide

  4. Won’t Cover
    Everything before the

    Phone Screen

    View full-size slide

  5. My Last
    Job Search

    View full-size slide

  6. Your Next
    Job Search

    View full-size slide

  7. 1

    Phone 

    Screen
    2

    Manager 

    Screen
    3

    Coding
    Test
    4
    Onsite
    Evals

    View full-size slide

  8. Stages
    0. Reach Out
    • Accepted application

    • Communication from
    Recruiter

    View full-size slide

  9. 1

    Phone 

    Screen
    2

    Manager 

    Screen
    3

    Coding
    Test
    4
    Onsite
    Evals

    View full-size slide

  10. Stages
    1. Phone Screen
    • High level

    • Why are you looking

    • What are you looking for

    • Pitch on company/role

    View full-size slide

  11. Stages
    1. Phone Screen
    • Why

    • What
    PREP

    View full-size slide

  12. Stages
    1. Phone Screen
    • Structure of teams

    • Favorite projects

    PREP

    View full-size slide

  13. Stages
    1. Phone Screen
    • $
    PREP

    View full-size slide

  14. 1

    Phone 

    Screen
    2

    Manager 

    Screen
    3

    Coding
    Test
    4
    Onsite
    Evals

    View full-size slide

  15. Stages
    • High level but deeper tech

    • Experience with specific
    technologies

    • Pitch on Company/Role
    2. Manager Screen

    View full-size slide

  16. Stages
    • Hard Problems

    • Best Projects

    • Failures

    • Technologies
    2. Manager Screen
    PREP

    View full-size slide

  17. 1

    Phone 

    Screen
    2

    Manager 

    Screen
    3

    Coding
    Test
    4
    Onsite
    Evals

    View full-size slide

  18. Stages
    3. Coding Test
    • Take Home

    • or

    • Online Platform

    View full-size slide

  19. Stages
    3. Coding Test - Take Home
    • Small project

    • Designing architecture

    • Designing APIs

    • Solving algorithms

    View full-size slide

  20. Stages
    3. Coding Test - Online
    • Small problem(s)

    • Algorithmic problem

    • Time complexity

    • Space complexity

    View full-size slide

  21. Stages
    3. Coding Test
    • Lite version of Coding and
    Sys Design on-site evals

    • Real world experience
    PREP

    View full-size slide

  22. Stages
    3. Coding Test
    • Sys Design & Architecture

    • Based on role 

    interviewing for
    PREP

    View full-size slide

  23. Stages
    3. Coding Test
    • APIs

    • REST

    • GraphQL

    • RPC
    PREP

    View full-size slide

  24. Stages
    3. Coding Test
    • Data Structures

    • Array, Stack, Queue, 

    BT, BST, Hash Table
    PREP

    View full-size slide

  25. Stages
    3. Coding Test
    • Algos

    • Common Techniques
    PREP

    View full-size slide

  26. Stages
    3. Coding Test
    • Algos

    • Pattern Matching
    PREP

    View full-size slide

  27. Stages
    3. Coding Test
    • Algos

    • Common Problems
    PREP
    + FizzBuzz, 8
    Queens, Boggle,
    Subset Sum, etc

    View full-size slide

  28. Stages
    3. Coding Test
    • Algos

    • Improvements
    PREP

    View full-size slide

  29. Stages
    3. Coding Test
    • Sorting

    • Bubble Sort

    • Quick Sort

    • Merge Sort
    PREP

    View full-size slide

  30. Stages
    3. Coding Test
    • Fill knowledge gaps
    PREP

    View full-size slide

  31. Stages
    3. Coding Test
    • PRACTICE
    PREP

    View full-size slide

  32. Time & Space
    Complexity

    View full-size slide

  33. Complexity
    Time Complexity

    Space Complexity

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  34. Complexity
    Big O notation

    images:https://www.geeksforgeeks.org/analysis-algorithms-big-o-analysis/

    View full-size slide

  35. Complexity
    O(1)
    $input = [1,2,3,4,5];
    return $input[3];

    View full-size slide

  36. Complexity
    O(log N)
    for ($i=0; $i<=count($input); $i*=2) {}

    View full-size slide

  37. Complexity
    O(N)
    for ($i=0; $i<=count($input); $i++) {}

    View full-size slide

  38. Complexity
    O(N log N)
    for ($i=0; $i<=count($input); $i++) {
    for ($j=0; $j<=count($input); $j*=2) {}
    }

    View full-size slide

  39. Complexity
    O(N2)
    for ($i=0; $i<=count($input); $i++) {
    for ($j=0; $j<=count($input); $j++) {}
    }

    View full-size slide

  40. Complexity
    O(N!)
    function factorial($n) {
    $factorial = 1;
    for ($i = 1; $i <= $n; $i++){
    $factorial = $factorial * $i;
    }
    return $factorial;
    }
    for ($i = 0; $i <= factorial(8); $i++) { }

    View full-size slide

  41. Data
    Structures

    View full-size slide

  42. Data Structures
    Array

    Stack

    Queue

    Linked List

    Tree

    Graph

    Hash Table

    Linear Non-linear

    View full-size slide

  43. Data Structures
    Array

    Stack

    Queue

    Linked List

    Linear Non-linear
    Tree

    Graph

    Hash Table

    View full-size slide

  44. Data Structures
    array

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  45. Data Structures
    $array = ['Item1', 'Item2'];
    $array[0] => Item1

    View full-size slide

  46. Data Structures
    $array = [
    ['Item1-1', 'Item1-2'],
    ['Item2-1', 'Item2-2'],
    ];
    $array[0][1] => Item1-2

    View full-size slide

  47. Data Structures
    $array = [
    'namedIndex' => 'value'
    ];
    $array['namedIndex'] => value

    View full-size slide

  48. Data Structures
    stack

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  49. Data Structures
    $stack = [0, 1, 2];
    array_pop($stack) => 2
    var_dump($stack) => [0, 1]

    View full-size slide

  50. Data Structures
    public isEmpty() : bool
    public pop() : mixed
    public push(mixed $value) : void

    View full-size slide

  51. Data Structures
    $stack = new Stack([0, 1, 2]);
    $stack->pop() => 2
    var_dump($stack) => [0, 1]

    View full-size slide

  52. Data Structures
    $stack = new Stack([0, 1]);
    $stack->push() => 3
    var_dump($stack) => [3, 0, 1]

    View full-size slide

  53. Data Structures
    queue

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  54. Data Structures
    $queue = [0, 1, 2];
    array_pop_first($queue) => 0
    var_dump($queue) => [1, 2]

    View full-size slide

  55. Data Structures
    public isEmpty() : bool
    public pop() : mixed
    public push(mixed $value) : void

    View full-size slide

  56. Data Structures
    public isEmpty() : bool
    public dequeue() : mixed
    public enqueue(mixed $value) : void

    View full-size slide

  57. Data Structures
    $queue = new Queue([0, 1, 2]);
    $queue->pop() => 0
    var_dump($queue) => [1, 2]

    View full-size slide

  58. Data Structures
    $queue = new Queue([1, 2]);
    $queue->push() => 3
    var_dump($queue) => [1, 2, 3]

    View full-size slide

  59. Data Structures
    linked list

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  60. Data Structures
    doubly linked list

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  61. Data Structures
    $l = new SplDoublyLinkedList;
    $l->push('a');
    $l->push('b');
    $l->push('c');
    for ($l->rewind(); $l->valid(); $l->next()) {
    echo $l->current() . ', ';
    }
    => a, b, c

    View full-size slide

  62. Data Structures
    $l = new SplDoublyLinkedList;
    $l->push('a');
    $l->push('b');
    $l->push('c');
    $list->rewind();
    echo $list->current() . ', ';
    $list->next();
    echo $list->current() . ', ';
    $list->prev();
    echo $list->current();
    = > a, b, a

    View full-size slide

  63. Data Structures
    hash table

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  64. Data Structures
    $hashMap = [
    sha1('first') => 1,
    sha1('second') => 2
    ];
    $hashMap[sha1('first')] => 1

    View full-size slide

  65. Data Structures
    $hashMap = [];
    for ($i=1; $i<=10; $i++){
    $hash = $i % 3;
    $hashMap[$hash] =
    isset($hashMap[$hash]) ?
    $hashMap[$hash] + $i : $i;
    }
    $hashMap[0] => 18

    View full-size slide

  66. Data Structures
    graph

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  67. Data Structures
    graph

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  68. Data Structures
    graph

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures
    follow edges

    add to Queue

    process queue
    Breadth First
    Traversal

    View full-size slide

  69. Data Structures
    https://www.tutorialspoint.com/data_structures_algorithms/breadth_first_traversal.htm

    View full-size slide

  70. Data Structures
    graph

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures
    follow edges

    add to Stack

    process stack
    Depth First
    Traversal

    View full-size slide

  71. Data Structures
    https://www.tutorialspoint.com/data_structures_algorithms/breadth_first_traversal.htm

    View full-size slide

  72. Data Structures
    tree

    images: https://blog.devmountain.com/what-you-should-know-about-data-structures

    View full-size slide

  73. Data Structures
    binary search tree
    (BST)

    https://delboy1978uk.wordpress.com/2018/02/06/binary-search-trees-in-php/

    View full-size slide

  74. Data Structures
    binary search tree
    (BST)

    23?
    https://delboy1978uk.wordpress.com/2018/02/06/binary-search-trees-in-php/

    View full-size slide

  75. Data Structures
    binary search tree
    (BST)

    20?
    null
    https://delboy1978uk.wordpress.com/2018/02/06/binary-search-trees-in-php/

    View full-size slide

  76. Data Structures
    binary search tree
    (BST)

    Breadth First
    Traversal
    https://delboy1978uk.wordpress.com/2018/02/06/binary-search-trees-in-php/
    5,2,11,1,4,
    7,23,16,34

    View full-size slide

  77. Data Structures
    binary search tree
    (BST)

    Depth First
    Traversal
    https://delboy1978uk.wordpress.com/2018/02/06/binary-search-trees-in-php/
    5, 2, 1, 4,
    11, 7, 23,
    16, 34

    View full-size slide

  78. Data Structures
    class Node
    {
    public $left, $right, $data;
    function __construct($data) {
    $this->data = $data;
    }
    }

    View full-size slide

  79. Data Structures
    class BST
    {
    public $rootNode;
    public function __construct($data=null)
    {
    if ($data !== null) {
    $this->rootNode = new Node($data);
    }
    }

    View full-size slide

  80. Data Structures
    public function search($data)
    {
    $node = $this->rootNode;
    while($node) {
    if ($data < $node->data) {
    $node = $node->left;
    } else if ($data > $node->data) {
    $node = $node->right;
    } else {
    break;
    }
    }
    return $node;
    }

    View full-size slide

  81. Data Structures
    trees IRL

    https://en.wikipedia.org/wiki/Radix_tree

    View full-size slide

  82. Data Structures
    https://en.wikipedia.org/wiki/Radix_tree

    View full-size slide

  83. Algorithms
    Techniques

    View full-size slide

  84. Algorithms
    techniques
    brute force

    View full-size slide

  85. Algorithms
    techniques
    divide and conquer

    View full-size slide

  86. Algorithms
    techniques
    dynamic

    View full-size slide

  87. Algorithms
    techniques
    greedy

    View full-size slide

  88. Algorithms
    techniques
    recursive

    View full-size slide

  89. Algorithms
    techniques
    backtracking

    View full-size slide

  90. Algorithms
    Sorting

    View full-size slide

  91. Algorithms
    quicksort
    https://en.wikipedia.org/wiki/Quicksort

    View full-size slide

  92. Algorithms
    quicksort
    https://en.wikipedia.org/wiki/Quicksort
    O(n log n)

    View full-size slide

  93. Algorithms
    merge sort
    https://en.wikipedia.org/wiki/Quicksort

    View full-size slide

  94. Algorithms
    merge sort
    https://en.wikipedia.org/wiki/Quicksort
    O(n log n)

    View full-size slide

  95. Algorithms
    Examples

    View full-size slide

  96. Algorithms
    fizz buzz
    Write a program that prints the numbers from 1 to 100
    and for multiples of ‘3’ print “Fizz” instead of the
    number and for the multiples of ‘5’ print “Buzz”.

    View full-size slide

  97. Algorithms
    for ($i=1; $i<=100; $i++) {
    if ($i%3 === 0) {
    echo 'Fizz';
    }
    else if ($i%5 === 0) {
    echo 'Buzz';
    }
    else {
    echo $i;
    }
    }

    View full-size slide

  98. Algorithms
    time complexity
    O(n)

    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  99. Algorithms
    single number
    Given a non-empty array of integers, every
    element appears twice except for one.

    Find that single one.

    View full-size slide

  100. Algorithms
    $input = [4, 1, 2, 1, 2];
    $noDups = [];
    foreach ($input as $value) {
    $k = array_search($value, $noDups);
    if ($k === false) {
    $noDups[] = $value;
    }
    else {
    unset($noDups[$k]);
    }
    }
    echo $noDups[0];

    View full-size slide

  101. Algorithms
    $input = [4, 1, 2, 1, 2];
    $noDups = [];
    foreach ($input as $value) {
    $k = array_search($value, $noDups);
    if ($k === false) {
    $noDups[] = $value;
    }
    else {
    unset($noDups[$k]);
    }
    }
    echo $noDups[0];

    View full-size slide

  102. Algorithms
    $input = [4, 1, 2, 1, 2];
    $noDups = [];
    foreach ($input as $value) {
    $k = array_search($value, $noDups);
    if ($k === false) {
    $noDups[] = $value;
    }
    else {
    unset($noDups[$k]);
    }
    }
    echo $noDups[0];

    View full-size slide

  103. Algorithms
    $input = [4, 1, 2, 1, 2];
    $noDups = [];
    foreach ($input as $value) {
    $k = array_search($value, $noDups);
    if ($k === false) {
    $noDups[] = $value;
    }
    else {
    unset($noDups[$k]);
    }
    }
    echo $noDups[0];

    View full-size slide

  104. Algorithms
    $input = [4, 1, 2, 1, 2];
    $noDups = [];
    foreach ($input as $value) {
    $k = array_search($value, $noDups);
    if ($k === false) {
    $noDups[] = $value;
    }
    else {
    unset($noDups[$k]);
    }
    }
    echo $noDups[0];

    View full-size slide

  105. Algorithms
    time complexity
    O(n2)

    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  106. Algorithms
    $input = [4, 1, 2, 1, 2];
    $hashmap = [];
    foreach ($input as $v) {
    $hashmap[$v] = isset($hashmap[$v]) ?
    $hashmap[$v]+1 : 1;
    }
    foreach ($hashmap as $k => $count) {
    if ($count === 1) {
    echo $k;
    break;
    }
    }

    View full-size slide

  107. Algorithms
    $input = [4, 1, 2, 1, 2];
    $hashmap = [];
    foreach ($input as $v) {
    $hashmap[$v] = isset($hashmap[$v]) ?
    $hashmap[$v]+1 : 1;
    }
    foreach ($hashmap as $k => $count) {
    if ($count === 1) {
    echo $k;
    break;
    }
    }

    View full-size slide

  108. Algorithms
    $input = [4, 1, 2, 1, 2];
    $hashmap = [];
    foreach ($input as $v) {
    $hashmap[$v] = isset($hashmap[$v]) ?
    $hashmap[$v]+1 : 1;
    }
    foreach ($hashmap as $k => $count) {
    if ($count === 1) {
    echo $k;
    break;
    }
    }

    View full-size slide

  109. Algorithms
    $hashmap = array(3) {
    [4]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(2)
    }

    View full-size slide

  110. Algorithms
    $input = [4, 1, 2, 1, 2];
    $hashmap = [];
    foreach ($input as $v) {
    $hashmap[$v] = isset($hashmap[$v]) ?
    $hashmap[$v]+1 : 1;
    }
    foreach ($hashmap as $k => $count) {
    if ($count === 1) {
    echo $k;
    break;
    }
    }

    View full-size slide

  111. Algorithms
    $input = [4, 1, 2, 1, 2];
    $hashmap = [];
    foreach ($input as $v) {
    $hashmap[$v] = isset($hashmap[$v]) ?
    $hashmap[$v]+1 : 1;
    }
    foreach ($hashmap as $k => $count) {
    if ($count === 1) {
    echo $k;
    break;
    }
    }

    View full-size slide

  112. Algorithms
    time complexity
    O(n)

    View full-size slide

  113. Algorithms
    8 queens
    Place eight queens on an 8×8 chessboard so that no
    two queens threaten each other; thus, a solution
    requires that no two queens share the same row,
    column, or diagonal.

    View full-size slide

  114. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  115. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  116. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  117. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  118. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  119. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  120. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  121. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  122. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  123. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  124. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  125. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  126. Algorithms
    public function run() : bool
    {
    // 8 to the power of 8 =
    // 16,777,216 possible board configurations
    $board = $this->generateBoard($hash);
    if (!$this->hasCollisions($board)) {
    return true;
    }
    $this->run($hash-1);
    }

    View full-size slide

  127. Algorithms
    time complexity
    Brute Force = O(nn)

    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  128. Algorithms
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  129. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  130. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  131. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  132. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  133. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  134. Algorithms
    8 queens
    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  135. Algorithms
    interface SolverInterface
    {
    public function getBoard() : array;
    public function format() : string;
    public function hasCollision(int $row, int $col) : bool;
    public function run(int $col) : bool;
    }
    class NQueensSolver implements SolverInterface {}

    View full-size slide

  136. Algorithms
    $solver = new NQueensSolver(8);
    $solver->run();
    $expectedBoard = [
    [1, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1],
    [0, 1, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 1, 0, 0, 0, 0, 0]
    ];
    echo 'Tests ' .
    ($solver->getBoard() === $expectedBoard ?
    'passed 🎉' : 'failed 🚨');

    View full-size slide

  137. Algorithms
    public function __construct($n=8)
    {
    $this->n = $n;
    $this->board = array_fill(
    0, $n, array_fill(0, $n, 0)
    );
    }

    View full-size slide

  138. Algorithms
    $this->board = [
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0]
    ];

    View full-size slide

  139. Algorithms
    public function getBoard() : array
    {
    return $this->board;
    }

    View full-size slide

  140. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  141. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  142. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  143. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  144. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  145. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  146. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  147. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  148. Algorithms
    public function run($col=0) : bool
    {
    // return true if we've iterated over the whole board
    if ($col >= $this->n) {
    return true;
    }
    // iterate over the rows
    for ($row = 0; $row < $this->n; ++$row) {
    if (!$this->hasCollision($row, $col)) {
    // place a queen
    $this->board[$row][$col] = 1;
    // check the next column to see if this worked
    if ($this->run($col+1)) {
    return true;
    }
    // this didn't work so let's remove the queen, backtrack, and try the next row
    $this->board[$row][$col] = 0;
    }
    }
    return false;
    }

    View full-size slide

  149. Algorithms
    public function hasCollision(int $row, int $col) : bool
    {
    // check the current row
    for ($thisCol = 0; $thisCol < $col; ++$thisCol) {
    if ($this->board[$row][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the top left
    // no need to check the top right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisRow >= 0 && $thisCol >= 0; $thisRow--, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the bottom left
    // no need to check the bottom right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisCol >= 0 && $thisRow < $this->n; $thisRow++, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    return false;
    }

    View full-size slide

  150. Algorithms
    public function hasCollision(int $row, int $col) : bool
    {
    // check the current row
    for ($thisCol = 0; $thisCol < $col; ++$thisCol) {
    if ($this->board[$row][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the top left
    // no need to check the top right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisRow >= 0 && $thisCol >= 0; $thisRow--, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the bottom left
    // no need to check the bottom right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisCol >= 0 && $thisRow < $this->n; $thisRow++, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    return false;
    }

    View full-size slide

  151. Algorithms
    public function hasCollision(int $row, int $col) : bool
    {
    // check the current row
    for ($thisCol = 0; $thisCol < $col; ++$thisCol) {
    if ($this->board[$row][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the top left
    // no need to check the top right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisRow >= 0 && $thisCol >= 0; $thisRow--, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    // check diagonally to the bottom left
    // no need to check the bottom right since we're processing one column at a time
    for ($thisRow = $row, $thisCol = $col; $thisCol >= 0 && $thisRow < $this->n; $thisRow++, $thisCol--) {
    if ($this->board[$thisRow][$thisCol]) {
    return true;
    }
    }
    return false;
    }

    View full-size slide

  152. Algorithms
    time complexity
    Brute Force = O(nn)

    Backtracking = O(n!)

    https://en.wikipedia.org/wiki/Eight_queens_puzzle

    View full-size slide

  153. Data Structures
    algorithms IRL

    https://en.wikipedia.org/wiki/Radix_tree

    View full-size slide

  154. 🛠 WORKSHOP
    https://bit.ly/passTechInterview

    Initial Phone Coding Test

    View full-size slide

  155. 1

    Phone 

    Screen
    2

    Manager 

    Screen
    3

    Coding
    Test
    4
    Onsite
    Evals

    View full-size slide

  156. Stages
    4. Onsite Evals
    • 4-6 hours onsite

    • Fly in, if not local

    View full-size slide

  157. Stages
    4. Onsite Evals
    • Coding

    • Behavioral

    • System Design

    View full-size slide

  158. Stages
    4. Onsite Evals
    • Arrive Thursday night

    • Interviews start 9am Friday

    View full-size slide

  159. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:20 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer

    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  160. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter
    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer

    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  161. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager
    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer

    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  162. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers
    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer
    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  163. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers
    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer
    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  164. Examples
    “Given an array of the 100 most common child
    names in 2021, sort them alphabetically”
    “List the top 10 products sold alphabetically on the
    sidebar of a site. Given an array of the top 1,000
    products where the key is their popularity and the value
    is the product name. Return an array.”
    Quicksort

    View full-size slide

  165. Examples
    “Given an array of the 100 most common child names in 2021, sort them
    alphabetically”
    Quicksort

    View full-size slide

  166. Examples
    “Given an array of the 100 most common child names in 2021, sort them
    alphabetically”
    const childNames = […];
    return childNames.quicksort();
    Quicksort

    View full-size slide

  167. Examples
    “List the top 10 products sold alphabetically on the sidebar of a site. Given an
    array of the top 1,000 products where the key is their popularity and the value
    is the product name. Return an array.”
    Quicksort

    View full-size slide

  168. Examples
    const products = […];
    return products.quicksort()
    .slice(0, 10)
    .quicksort();
    “List the top 10 products sold alphabetically on the sidebar of a site. Given an
    array of the top 1,000 products where the key is their popularity and the value
    is the product name. Return an array.”
    Quicksort

    View full-size slide

  169. Examples
    const products = […];
    return products.quicksort()
    .slice(0, 10)
    .quicksort();
    “List the top 10 products sold alphabetically on the sidebar of a site. Given an
    array of the top 1,000 products where the key is their popularity and the value
    is the product name. Return an array.”
    Quicksort

    View full-size slide

  170. 🛠 WORKSHOP
    https://bit.ly/passTechInterview

    On-Site Coding Test

    View full-size slide

  171. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:30 - sys design w/ sr architect
    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer

    • 2:30-3:20 - debrief w/ recruiter

    View full-size slide

  172. Examples
    System Design

    View full-size slide

  173. 🛠 WORKSHOP
    https://bit.ly/passTechInterview

    On-Site Sys Design

    View full-size slide

  174. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team
    • 1:30-2:20 - coding w/ 1 staff engineer

    • 3:30-4 - debrief w/ recruiter

    View full-size slide

  175. Stages
    4. Onsite Evals
    • 9-9:30 - arrival / meet recruiter

    • 9:30-10:20 - meet hiring manager

    • 10:30-11:20 - coding w/ 2 sr engineers

    • 11:30-12:30 - sys design w/ sr architect

    • 12:30-1:30 - lunch w/engineer on team

    • 1:30-2:20 - coding w/ 1 staff engineer

    • 3:30-4 - debrief w/ recruiter

    View full-size slide

  176. Examples
    Career Ladder

    View full-size slide

  177. Total Comp =
    Salary + Equity + Benefits

    View full-size slide

  178. Parting
    Thoughts

    View full-size slide

  179. Resources
    https://randallkanna.com/get-the-ultimate-list/
    https://leetcode.com
    https://levels.fyi
    http://www.crackingthecodinginterview.com https://educative.io

    View full-size slide

  180. Let’s Work Together
    Wayfair Careers Portal
    https://www.wayfair.com/careers/jobs
    Email me
    [email protected]

    View full-size slide