Deradees's Posts
Nairaland Forum › Deradees's Profile › Deradees's Posts
1 2 (of 2 pages)
This problem was asked by Facebook. Given a binary tree, return the level of the tree with minimum sum. |
This problem was asked by Google. Given a set of closed intervals, find the smallest set of numbers that covers all the intervals. If there are multiple smallest sets, return any of them. For example, given the intervals [0, 3], [2, 6], [3, 4], [6, 9], one set of numbers that covers all these intervals is {3, 6}. |
This problem was asked by Microsoft. You have n fair coins and you flip them all at the same time. Any that come up tails you set aside. The ones that come up heads you flip again. How many rounds do you expect to play before only one coin remains? Write a function that, given n, returns the number of rounds you'd expect to play until one coin remains. |
I will also share questions from cracking the coding interview by Gaayle Laakman McDowell |
This problem was asked by Facebook. Write a function that rotates a list by k elements. For example, [1, 2, 3, 4, 5, 6] rotated by two becomes [3, 4, 5, 6, 1, 2]. Try solving this without creating a copy of the list. How many swap or move operations do you need? |
This one no be for Tonto Dike lovers This problem was asked by LinkedIn. Given a string, return whether it represents a number. Here are the different kinds of numbers: "10", a positive integer "-10", a negative integer "10.1", a positive real number "-10.1", a negative real number "1e5", a number in scientific notation And here are examples of non-numbers: "a" "x 1" "a -2" "-" |
The Tower of Hanoi is a puzzle game with three rods and n disks, each a different size. All the disks start off on the first rod in a stack. They are ordered by size, with the largest disk on the bottom and the smallest one at the top. The goal of this puzzle is to move all the disks from the first rod to the last rod while following these rules: You can only move one disk at a time. A move consists of taking the uppermost disk from one of the stacks and placing it on top of another stack. You cannot place a larger disk on top of a smaller disk. Write a function that prints out all the steps necessary to complete the Tower of Hanoi. You should assume that the rods are numbered, with the first rod being 1, the second (auxiliary) rod being 2, and the last (goal) rod being 3. For example, with n = 3, we can do this in 7 moves: Move 1 to 3 Move 1 to 2 Move 3 to 2 Move 1 to 3 Move 2 to 1 Move 2 to 3 Move 1 to 3 |
This question was asked by Snapchat. Given the head to a singly linked list, where each node also has a “random” pointer that points to anywhere in the linked list, deep clone the list. |
This question was asked by Riot Games. Design and implement a HitCounter class that keeps track of requests (or hits). It should support the following operations: record(timestamp): records a hit that happened at timestamp total(): returns the total number of hits recorded range(lower, upper): returns the number of hits that occurred between timestamps lower and upper (inclusive) Follow-up: What if our system has limited memory? |
tollyboy5:You are welcome sir! Some are actually easy. I will share more questions as time unfolds. |
This problem was asked by Microsoft. Let's represent an integer in a linked list format by having each node represent a digit in the number. The nodes make up the number in reversed order. For example, the following linked list: 1 -> 2 -> 3 -> 4 -> 5 is the number 54321. Given two linked lists in this format, return their sum in the same linked list format. For example, given 9 -> 9 5 -> 2 return 124 (99 + 25) as: 4 -> 2 -> 1 |
This problem was asked by Google. Given a string of words delimited by spaces, reverse the words in string. For example, given "hello world here", return "here world hello" Follow-up: given a mutable string representation, can you perform this operation in-place? |
This question was asked by Zillow. You are given a 2-d matrix where each cell represents number of coins in that cell. Assuming we start at matrix[0][0], and can only move right or down, find the maximum number of coins you can collect by the bottom right corner. For example, in this matrix 0 3 1 1 2 0 0 4 1 5 3 1 The most we can collect is 0 + 2 + 1 + 5 + 3 + 1 = 12 coins. |
I think this one is easy Given a real number n, find the square root of n. For example, given n = 9, return 3. |
This question was asked by Apple. Given a binary tree, find a minimum path sum from root to a leaf. For example, the minimum path in this tree is [10, 5, 1, -1], which has sum 15. 10 / \ 5 5 \ \ 2 1 / -1 |
This problem was asked by Amazon. Given a node in a binary search tree, return the next bigger element, also known as the inorder successor. For example, the inorder successor of 22 is 30. 10 / \ 5 30 / \ 22 35 |
Let's get our hands soiled with code This problem was asked by Facebook. You have a large array with most of the elements as zero. Use a more space-efficient data structure, SparseArray, that implements the same interface: init(arr, size): initialize with the original large array and size. set(i, val): updates index at i with val. get(i): gets the value at index i. |
This question was asked by Google. Given an N by M matrix consisting only of 1's and 0's, find the largest rectangle containing only 1's and return its area. For example, given the following matrix: [[1, 0, 0, 0], [1, 0, 1, 1], [1, 0, 1, 1], [0, 1, 0, 0]] |
Here is another one This problem was asked by Google. You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string. Determine whether the parentheses are balanced. |
This problem was asked by Microsoft. I am finding it difficult to upload the screenshot of the problem so I had to copy it. Implement 3 stacks using a single list: class Stack: def __init__(self): self.list = [] def pop(self, stack_number): pass def push(self, item, stack_number): pass |
Let us solve interview problems from dailycodingproblem.com together |
Sixtus United |
Please I need materials on android development. I am in dire need of it. My e-mail address is chideraamadi66@gmail.com. Thank you |
1 2 (of 2 pages)