tag:blogger.com,1999:blog-61921948855539777382017-09-20T22:59:34.983-07:00Amazon.com Interview Questions and PuzzlesAmazon interview questions blog. Part of www.technical-interview.comAdministratornoreply@blogger.comBlogger27125tag:blogger.com,1999:blog-6192194885553977738.post-41055998905424680192011-10-15T04:58:00.001-07:002011-10-15T04:58:37.463-07:00Classify the Hashing Functions based on the various methods by which the key value is foundAdministratornoreply@blogger.com0tag:blogger.com,1999:blog-6192194885553977738.post-88624549066441784072011-09-30T10:15:00.001-07:002011-09-30T10:15:16.607-07:00Common multipleQ: Given two numbers m and n, write a method to return the first number r that is<br />divisible by both (e.g., the least common multiple).<br /><br />A:<br />The Approach:<br />What does it mean for r to be divisible by m and n? It means that all the primes in m must go into r, and all primes in n must be in r. What if m and n have primes in common?<br /><br />For example, if m is divisible by 3^5 and n is divisible by 3^7, what does this mean about r? It means r must be divisible by 3^7.<br /><br />The Rule: For each prime p such that p^a \ m (e.g., m is divisible by p^a) and p^b \ n, r must be divisible by p^max(a, b)<br /><br />The Algorithm:<br />Define q to be 1.<br />for each prime number p less than m and n:<br />find the largest a and b such that p^a \ m and p^b \ n<br />let q = q * p^max(a, b)<br />return qAdministratornoreply@blogger.com14tag:blogger.com,1999:blog-6192194885553977738.post-78565342131620028232010-04-28T11:56:00.001-07:002010-04-28T11:56:33.857-07:00Car is travelingA car is traveling at a uniform speed.The driver sees a milestone showing a 2-digit number. After traveling for an hour the driver sees another milestone with the same digits in reverse order.After another hour the driver sees another milestone containing the same two digits. What is the average speed of the driver?<br /><br /><b>Ans</b><br /><br />45 kmphAdministratornoreply@blogger.com22tag:blogger.com,1999:blog-6192194885553977738.post-70155605570382530312010-04-28T11:54:00.001-07:002010-04-28T11:55:19.461-07:00Father's ageFather's age is three years more than three times the son's age.After three years, father's age will be ten years more than twice the son's age. What is the father's present age?<br /><br /><br /><b>Ans:</b><br />33 years.Administratornoreply@blogger.com19tag:blogger.com,1999:blog-6192194885553977738.post-72068020378523730892010-04-28T11:53:00.001-07:002010-04-28T11:53:23.747-07:00General Questions1- Why do you like to work with us?<br /><br />2- What work are you expecting?<br /><br />3- Tell me about any of your experienceAdministratornoreply@blogger.com0tag:blogger.com,1999:blog-6192194885553977738.post-1121103525298067332010-04-28T11:51:00.001-07:002010-04-28T11:51:47.037-07:00Top commandWhat is the functionality of a top command?<br /><br /><b>Ans</b><br />Top command displays all the Linux tasks running at that particular time. It provides their running time and the resources used.Administratornoreply@blogger.com0tag:blogger.com,1999:blog-6192194885553977738.post-37439727713496456042010-04-28T11:50:00.000-07:002010-04-28T11:52:05.144-07:00Array of sizeGiven an array of size n+1 which contains all the numbers from 1 to n. Find the number which is repeated in O(n) time. How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?<br /><br /><b>Ans</b><br /><br />The number appearing 2 times is (sum of all the numbers in the array) - (sum of the numbers from 1 to n). For floating numbers multiply it with 100 and proceed.Administratornoreply@blogger.com18tag:blogger.com,1999:blog-6192194885553977738.post-67407782634203297832010-04-28T11:49:00.000-07:002010-04-28T11:49:14.460-07:00Two trains enter at the oppositeTwo trains enter at the opposite sides of a tunnel of length L with speeds 'V'. A particle enters the tunnel at the same time with a speed 'v' and it vibrates in the tunnel[i.e. if it reaches the end of the tunnel then it comes back]. What is the position of the particle by the time the 2 trains meet?<br /><br /><b>Ans</b><br /><br />If v<=2V then the position is (v*L)/(2*V) from the starting point else it is 2*L -(v*L)/(2*V) from the starting point.Administratornoreply@blogger.com5tag:blogger.com,1999:blog-6192194885553977738.post-73682242769229086692010-04-24T11:56:00.001-07:002010-04-24T17:12:13.278-07:00Amazon.comType: Public<br />On the web: http://www.amazon.com<br />Employees: 24,300<br />Employee growth: 17.4% <br /><br />What started as Earth's biggest bookstore has rapidly become Earth's biggest anything store. Expansion has propelled Amazon.com in innumerable directions. Its main Web site offers millions of books, music, and movies (which still account for most of its sales), not to mention auto parts, toys, electronics, home furnishings, apparel, health and beauty aids, prescription drugs, and groceries. Also, shoppers can download books, games, MP3s, and films to their computers or handheld devices, including Amazon's own portable reader, the Kindle. Amazon also offers services and products, such as self-publishing, online advertising, a Web store platform, and a co-branded credit card. Amazon acquired Zappos.com in 2009. <br /><br />Key numbers for fiscal year ending December, 2009: <br />Sales: $24,509.0M<br />One year growth: 27.9%<br />Net income: $902.0M<br />Income growth: 39.8% <br /><br />Officers:<br />Chairman, President, and CEO: Jeffrey P. (Jeff) Bezos<br />SVP and CFO: Thomas J. (Tom) Szkutak<br />Senior Manager Business Development: Scott MerlinoAdministratornoreply@blogger.com1tag:blogger.com,1999:blog-6192194885553977738.post-62923654151686606332010-04-24T11:48:00.002-07:002010-04-24T11:48:49.747-07:00Missing numberGiven an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number.Administratornoreply@blogger.com13tag:blogger.com,1999:blog-6192194885553977738.post-38637046282091945332010-04-24T11:48:00.000-07:002010-04-24T11:48:03.701-07:00Denominations of coinsYou are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?Administratornoreply@blogger.com21tag:blogger.com,1999:blog-6192194885553977738.post-5172018051410321552010-04-24T11:47:00.000-07:002010-04-24T11:47:19.075-07:00Maximum sumGiven an array all of whose elements are positive numbers, find the maximum sum of a subsequent elements with the constraint that no 2 numbers in the sequence should be adjacent in the array. So, 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)Administratornoreply@blogger.com12tag:blogger.com,1999:blog-6192194885553977738.post-88265138094861631392010-04-24T11:43:00.002-07:002010-04-24T11:43:49.214-07:00PolymorphismExplain polymorphism. Provide an example.Administratornoreply@blogger.com1tag:blogger.com,1999:blog-6192194885553977738.post-72863949256864271632010-04-24T11:43:00.000-07:002010-04-24T11:43:22.311-07:00Convert a decimal numberHow do you convert a decimal number to its hexa-decimal equivalent. Give a C code to do so.Administratornoreply@blogger.com6tag:blogger.com,1999:blog-6192194885553977738.post-23615930182217601072010-04-24T11:42:00.001-07:002010-04-24T11:42:33.878-07:00Array of size nGiven an array of size n, containing every element from 1 to n+1, except one. Find the missing element.Administratornoreply@blogger.com7tag:blogger.com,1999:blog-6192194885553977738.post-67245128597040588932010-04-24T11:41:00.002-07:002010-04-24T11:41:51.300-07:00Second largest elemenFind the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.Administratornoreply@blogger.com10tag:blogger.com,1999:blog-6192194885553977738.post-48232516591944825152010-04-24T11:41:00.000-07:002010-04-24T11:41:18.955-07:00N red ballsGiven n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.Administratornoreply@blogger.com7tag:blogger.com,1999:blog-6192194885553977738.post-47958641512850851002010-04-24T11:40:00.001-07:002010-04-24T11:40:39.823-07:00Write a function whichWrite a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.Administratornoreply@blogger.com2tag:blogger.com,1999:blog-6192194885553977738.post-18913043308540445652010-04-24T11:39:00.002-07:002010-04-24T11:39:51.769-07:00Merge SortWhat is the time and space complexities of merge sort and when is it preferred over quick sort?Administratornoreply@blogger.com2tag:blogger.com,1999:blog-6192194885553977738.post-18105158345795074302010-04-24T11:39:00.000-07:002010-04-24T11:39:07.883-07:00What is a C array and illustrate how it is different from a list.Administratornoreply@blogger.com0tag:blogger.com,1999:blog-6192194885553977738.post-88122608105771506382010-04-24T11:38:00.001-07:002010-04-24T11:38:21.921-07:00Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.Administratornoreply@blogger.com8tag:blogger.com,1999:blog-6192194885553977738.post-29386791073696612142010-04-24T11:37:00.002-07:002010-04-24T11:37:50.720-07:00You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)Administratornoreply@blogger.com2tag:blogger.com,1999:blog-6192194885553977738.post-62103170081027953462010-04-24T11:37:00.000-07:002010-04-24T11:37:14.667-07:00Given a string, find the first unrepeated character in it? Give some test cases.Administratornoreply@blogger.com1tag:blogger.com,1999:blog-6192194885553977738.post-22473750247843825072010-04-24T11:36:00.001-07:002010-04-24T11:36:35.898-07:00Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which arenâ€™t present.Administratornoreply@blogger.com2tag:blogger.com,1999:blog-6192194885553977738.post-91968486445276787222010-04-24T11:35:00.000-07:002010-04-24T11:35:24.480-07:00Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.Administratornoreply@blogger.com3