Deradees's Posts
Nairaland Forum › Deradees's Profile › Deradees's Posts
1 2 (of 2 pages)
freemanbubble:If I (an itibolibo) can learn it, anybody can learn It as well. Just be committed |
freemanbubble:You can learn programming on your own |
Given a 2-D matrix representing an image, a location of a pixel in the screen and a color C, replace the color of the given pixel and all adjacent same colored pixels with C. For example, given the following matrix, and location pixel of (2, 2), and 'G' for green: B B W W W W W W W B B B Becomes B B G G G G G G G B B B |
This problem was asked by Triplebyte. You are given n numbers as well as n probabilities that sum up to 1. Write a function to generate one of the numbers with its corresponding probability. For example, given the numbers [1, 2, 3, 4] and probabilities [0.1, 0.5, 0.2, 0.2], your function should return 1 10% of the time, 2 50% of the time, and 3 and 4 20% of the time. You can generate random numbers between 0 and 1 uniformly. |
This problem was asked by Amazon. Implement a stack API using only a heap. A stack implements the following methods: push(item), which adds an element to the stack pop(), which removes and returns the most recently added element (or throws an error if there is nothing on the stack) Recall that a heap has the following operations: push(item), which adds a new key to the heap pop(), which removes and returns the max value of the heap |
This problem was asked by Facebook. Given a positive integer n, find the smallest number of squared integers which sum to n. For example, given n = 13, return 2 since 13 = 32 + 22 = 9 + 4. Given n = 27, return 3 since 27 = 32 + 32 + 32 = 9 + 9 + 9. |
This problem was asked by Amazon. Given a string, determine whether any permutation of it is a palindrome. For example, carrace should return true, since it can be rearranged to form racecar, which is a palindrome. daily should return false, since there's no rearrangement that can form a palindrome. |
This problem was asked by Slack. You are given an N by M matrix of 0s and 1s. Starting from the top left corner, how many ways are there to reach the bottom right corner? You can only move right and down. 0 represents an empty space while 1 represents a wall you cannot walk through. For example, given the following matrix: [[0, 0, 1], [0, 0, 1], [1, 0, 0]] Return two, as there are only two ways to get to the bottom right: Right, down, down, right Down, right, down, right The top left corner and bottom right corner will always be 0. |
Given a 32-bit integer, return the number with its bits reversed. For example, given the binary number 1111 0000 1111 0000 1111 0000 1111 0000, return 0000 1111 0000 1111 0000 1111 0000 1111. |
This problem was asked by Square. Given a list of words, return the shortest unique prefix of each word. For example, given the list: dog cat apple apricot fish Return the list: d c app apr f |
This problem was asked by Jane Street. Given an arithmetic expression in Reverse Polish Notation, write a program to evaluate it. The expression is given as a list of numbers and operands. For example: [5, 3, '+'] should return 5 + 3 = 8. For example, [15, 7, 1, 1, '+', '-', '/', 3, '*', 2, 1, 1, '+', '+', '-'] should return 5, since it is equivalent to ((15 / (7 - (1 + 1))) * 3) - (2 + (1 + 1)) = 5. You can assume the given expression is always valid. |
This problem was asked by Google. You are given an array of length n + 1 whose elements belong to the set {1, 2, ..., n}. By the pigeonhole principle, there must be a duplicate. Find it in linear time and space. |
This problem was asked by Google. Given an array of integers, return a new array where each element in the new array is the number of smaller elements to the right of that element in the original input array. For example, given the array [3, 4, 9, 6, 1], return [1, 1, 2, 1, 0], since: There is 1 smaller element to the right of 3 There is 1 smaller element to the right of 4 There are 2 smaller elements to the right of 9 There is 1 smaller element to the right of 6 There are no smaller elements to the right of 1 |
Can you please help me with the link to download the movie Concussions. It is a 2015 movie featuring Will Smith as Dr Omalu. Thanks |
kennygee:Age is just a number. Love conquers all |
Please, I also need the book and other books on android. My e-mail address is chideraamadi66@gmail.com |
This problem was asked by Google. Given the head of a singly linked list, reverse it in-place. |
This problem was asked by Lyft. Given a list of integers and a number K, return which contiguous elements of the list sum to K. For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should return [2, 3, 4], since 2 + 3 + 4 = 9. |
This question was asked by Google. Given an integer n and a list of integers l, write a function that randomly generates a number from 0 to n-1 that isn't in l (uniform). |
This problem was asked by Amazon. Given a N by M matrix of numbers, print out the matrix in a clockwise spiral. For example, given the following matrix: [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]] You should print out the following: 1 2 3 4 5 10 15 20 19 18 17 16 11 6 7 8 9 14 13 12 |
This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? |
This problem was asked by Google. Determine whether a doubly linked list is a palindrome. What if it’s singly linked? For example, 1 -> 4 -> 3 -> 4 -> 1 returns True while 1 -> 4 returns False. |
You are in an infinite 2D grid where you can move in any of the 8 directions: (x,y) to (x+1, y), (x - 1, y), (x, y+1), (x, y-1), (x-1, y-1), (x+1,y+1), (x-1,y+1), (x+1,y-1) You are given a sequence of points and the order in which you need to cover the points. Give the minimum number of steps in which you can achieve it. You start from the first point. Example: Input: [(0, 0), (1, 1), (1, 2)] Output: 2 It takes 1 step to move from (0, 0) to (1, 1). It takes one more step to move from (1, 1) to (1, 2). |
This problem was asked by Palantir. Given a number represented by a list of digits, find the next greater permutation of a number, in terms of lexicographic ordering. If there is not greater permutation possible, return the permutation with the lowest value/ordering. For example, the list [1,2,3] should return [1,3,2]. The list [1,3,2] should return [2,1,3]. The list [3,2,1] should return [1,2,3]. Can you perform the operation without allocating extra memory (disregarding the input memory)? |
This problem was asked by Amazon. Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string "AAAABBBCCDAA" would be encoded as "4A3B2C1D2A". Implement run-length encoding and decoding. You can assume the string to be encoded have no digits and consists solely of alphabetic characters. You can assume the string to be decoded is valid. |
This problem was asked by Dropbox. What does the below code snippet print out? How can we fix the anonymous functions to behave as we'd expect? functions = [] for i in range(10): functions.append(lambda : i) for f in functions: print(f()) |
This problem was asked by Facebook. Given a string and a set of delimiters, reverse the words in the string while maintaining the relative order of the delimiters. For example, given "hello/world:here", return "here/world:hello" Follow-up: Does your solution work for the following cases: "hello/world:here/", "hello//world:here" |
This problem was asked by Facebook. Given an array of numbers representing the stock prices of a company in chronological order and an integer k, return the maximum profit you can make from k buys and sells. You must buy the stock before you can sell it, and you must sell the stock before you can buy it again. For example, given k = 2 and the array [5, 2, 4, 0, 1], you should return 3. |
This problem was asked by Square. Given a string and a set of characters, return the shortest substring containing all the characters in the set. For example, given the string "figehaeci" and the set of characters {a, e, i}, you should return "aeci". If there is no substring containing all the characters in the set, return null. |
This problem was asked by Jane Street. Generate a finite, but an arbitrarily large binary tree quickly in O(1). That is, generate() should return a tree whose size is unbounded but finite. |
This problem was asked by Google. Given a sorted list of integers, square the elements and give the output in sorted order. For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81]. |
1 2 (of 2 pages)