Average of Levels in Binary Tree
This question is asked by Facebook. Given a reference to the root of a binary tree, return a list containing the average value in each level of the tree.
This question is asked by Facebook. Given a reference to the root of a binary tree, return a list containing the average value in each level of the tree.
Given a binary tree, return its level order traversal where the nodes in each level are ordered from left to right.
Given a binary tree, return the bottom-left most value.
This question is asked by Facebook. You are given a two dimensional matrix, friends, that represents relationships between coworkers in an office. If friendsi = 1 then coworker i is friends with coworker j and coworker j is friends with coworker i. Similarly if friendsi = 0 then coworker i is not friends with coworker j and coworker j is not friend with coworker i. Friendships in the office are transitive (i.e., if coworker one is friends with coworker two and coworker two is friends with coworker three, coworker one is also friends with coworker three). Given the friendships in the office defined by friends, return the total number of distinct friends groups in the office.
This question is asked by Facebook. Given an undirected graph, determine whether it is bipartite.
This question is asked by Amazon. Given N distinct rooms that are locked, we want to know if you can unlock and visit every room. Each room has a list of keys in it that allows you to unlock and visit other rooms. We start with room 0 being unlocked. Return whether or not we can visit every room.
You are given two lists of integers and an integer representing a process id to kill. One of the lists represents a list of process ids and the other represents a list of each of the processes' corresponding (by index) parent ids. When a process is killed, all of its children should also be killed. Return a list of all the process ids that are killed as a result of killing the requested process.
You are given a two-dimensional matrix that represents a plot of land. Within the matrix there exist two values: ones which represent land and zeroes which represent water within a pond. Given that parts of a pond can be connected both horizontally and vertically (but not diagonally), return the largest pond size.
Given a 2D array grid, where zeroes represent water and ones represent land, return the size of the largest island.
This question is asked by Google. Given an N-ary tree, return its maximum depth.
Given a 2D array of integers with ones representing land and zeroes representing water, return the number of islands in the grid.
You're about to set sail off a pier and first want to count the number of ships that are already in the harbor. The harbor is deemed safe to sail in if the number of boats in the harbor is strictly less than limit. Given a 2D array that presents the harbor, where O represents water and S represents a ship, return whether or not it's safe for you to set sail.
Given a 2D array containing only the following values: -1, 0, 1 where -1 represents an obstacle, 0 represents a rabbit hole, and 1 represents a rabbit, update every cell containing a rabbit with the distance to its closest rabbit hole.
Given a 2D array where each cell can have one of three values: