Let's take a look at one of the best classic games!
(https://www.youtube.com/watch?v=ia8bhFoqkVE "Super Mario Bros Gameplay") (Watch from 0:00 - 1:00)
If you already understand the basics of how Super Mario works, feel free to skip to the prompt!
Let's take a look at one of the best classic games!
(https://www.youtube.com/watch?v=ia8bhFoqkVE "Super Mario Bros Gameplay") (Watch from 0:00 - 1:00)
If you already understand the basics of how Super Mario works, feel free to skip to the prompt!
Write a function that determines if a path exists between two vertices of a directed graph.
Recall that a graph is a collection of connections, or 'edges', linking together nodes or verticies. In a directed graph, each edge is like an arrow or a one-way street-- an edge linking A to B indicates that A connects to B, but not that B connects to A.
The graph passed to the function will be represented as an object with a structure sometimes called an 'adjacency list' or 'adjacency map', in which each key represents a node in the graph, and each value will consist in an array of nodes which can be reached from the key. For example, the following object:
Write a function that determines whether an input string has balanced brackets.
You are given an input string consisting of brackets—square [ ]
, round ( )
, and curly { }
. The input string can include other text. Write a function that returns either true
if the brackets in the input string are balanced or false
if they are not. Balanced means that any opening bracket of a particular type must also have a closing bracket of the same type.
An empty input string or a string without brackets can also be considered "balanced".
Romeo lingers near the Capulet house to talk with Juliet when she appears in her window. The pair declare their love for one another and intend to marry the next day. With the help of Juliet's Nurse, the lovers arrange to marry when Juliet goes for confession at the cell of Friar Laurence. There, they are secretly married (talk about a short engagement).
Given a target sum and an array of positive integers, return true if any combination of numbers in the array can add to the target. Each number in the array may only be used once. Return false if the numbers cannot be used to add to the target sum.
subsetSum(2, [1, 10, 5, 3]); // false
subsetSum(10, [1, 10, 5, 3]); // true (10 === 10)
subsetSum(9, [1, 10, 5, 3]); // true (1+3+5 === 9)
Given a staircase with a given number of stairs, num, write a function that returns the number of different ways one can climb this set of stairs. A person is able to climb the stairs either one at a time, or skip a step, or a mix of both.
climbStairs(2); // should return 2: one step at a time (1 + 1), or skip a step (2).
climbStairs(0); // should return 1
climbStairs(1); // should return 1
climbStairs(5); // should return 8
climbStairs(100); // should return 573147844013817200640
We are going to design our own code editor. For this exercise, we’ll assume that we are implementing this project using React and Redux. We are specifically interested in the design decisions we would make to allow users to manipulate the layout of various panels on their screen, and to keep track of user edits to their files.
Interviewees are encouraged to begin by drawing a diagram of what this code editor would look like.
These kinds of design questions are meant to foster a thoughtful conversation between you and your interviewer, and help your interviewer understanding how you approach and solve problems. By nature, they do not have a single correct answer. Therefore, the following offers just one of many possible solutions.