Skip to main content

Amazon - Some interview quesions

Interview Questions :

1. Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.

2. What are the 4 basics of OOP?

3. Define Data Abstraction. What is its importance?

4. Given 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.

5. Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren?t present.

6. Given a string,find the first un-repeated character in it? Give some test cases

7. You 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.)

8. Given 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.

9. What is a C array and illustrate the how is it different from a list.

10. What is the time and space complexities of merge sort and when is it preferred over quick sort?

11. Write 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.

12. Given 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.

13. Find 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.

14. Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

15. How do you convert a decimal number to its hex-decimal equivalent.Give a C code to do the same

16. Explain polymorphism. Provide an example.

17. Given an array all of whose elements are positive numbers, find the maximum sum of a sub sequence 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)

18. You 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?

19. Given 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

Comments

Popular posts from this blog

Introduction to JavaScript- Basics

JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari. What You Should Already Know Before you continue you should have a basic understanding of the following: HTML and CSS If you want to study these subjects first, find the tutorials on our Languages page . What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Everyone can use JavaScript without purchasing a license Are Java and JavaScript the same? NO! Java and JavaScript are two completely different languages in both concept and design! Java (developed by Sun Microsystems) is a powerful and much more complex programming language ...

How to prepare for interview? follow the steps.

Interview Preparation  Research is a critical part of preparing for an interview. If you haven't done your homework, it is going to be obvious. Spend time researching and thinking about yourself, the occupation, the organization, and questions you might ask at the end of the interview. Step 1: Know Yourself The first step in preparing for an interview is to do a thorough self-assessment so that you will know what you have to offer an employer. It is very important to develop a complete inventory of skills, experience, and personal attributes that you can use to market yourself to employers at any time during the interview process. In developing this inventory, it is easiest to start with experience. Once you have a detailed list of activities that you have done (past jobs, extra-curricular involvements, volunteer work, school projects, etc.), it is fairly easy to identify your skills. Simply g...

Cognizant Company Profile and it's information for Interview

Website: www.cognizant.com HQ Teaneck, NJ Industry Information Technology Services Size 130K+ Employees, $6B+ Revenue NASDAQ CTSH Competitors Infosys, Wipro, Tata Consultancy Services   About cognizant Cognizant Corporate view: Cognizant is an American multinational IT services and consulting corporation headquartered in Teaneck, New Jersey, United States. Cognizant has been named to the 2010 Fortune 100 Fastest-Growing Companies List for the eighth consecutive year. Cognizant has also been named to the Fortune 1000 and Forbes Global 2000 lists. It has consistently ranked among the fastest growing companies including the 2010 Business Week 50 list of the top-performing U.S. companies, the Business Week Hottest Tech Companies 2010, and the Forbes Fast Tech 2010 list of 25 Fastest Growing Technology Companies In America. Founded: 1994 Headquarters: Teaneck, New Jersey, U.S. Key people:  Francisco D'Souza (President & CEO) Lakshmi Naray...