Suppose you have an array of 99 numbers. The array contains the digits 1 to 100 with one digit missing. Describe four different algorithms to compute the missing number. Two of these should optimize for low storage and two of these should optimize for fast processing.
PHP Performance Interview Questions
Questions to ask a PHP Developer
PHP engineers are often required to have a knowledge of the full web stack: starting with the ability to write optimized SQL queries, and wrapping up with a good understanding of HTML/CSS. When interviewing a PHP developer, make sure that you think through your requirements and ask good questions for all of them.
Here's a suggestion for a good menu of PHP interview questions:
- Start off with some basic SQL such as SQL Skills: Joins, Averages and Sums
- Include at least one simple coding task such as Separate a list of integers or Find the missing number
- Explore their ability to come up with an overall system design and data model with a flexible question like Design a restaurant reservation system or Design a card game system
- Ensure that they have a solid understanding of the basic building blocks of the web by asking about HTTP GET and POST or What are HTTP cookies?
- Wrap up with some CSS questions like Explore the HTML display and position attributes or CSS rule-set basics
- Describe how you would store a social graph in a relational database.
- Describe an efficient algorithm to determine whether or not person X is a 2nd degree connection of person Y.
- Describe an efficient algorithm to determine whether or not person X is a 3rd degree connection of person Y.
- How can you make #3 very quick. E.g. how does Linked In compute 3rd degree connections quickly?
Write a string to find a substring in a given string. Do this in O(n) or better
What is a hashtable? Give an example of a type of problem that a hashtable is useful for.
Explain big o notation and how it is useful in computer science to classify algorithms.
- What order is a hash table lookup?
- What order is determining if a number is even or odd?
- What order is finding an item in an unsorted list?
- What order is a binary search?
For the data structures: Array and Linked List explain:
- Where you might use them
- Operations that are commonly supported (add, insert etc)
What is load balancing? Describe three different types of load balancing techniques? What problems can load balancing solve? What problems can it introduce?
Efficiently calculate the shortest distance between two Facebook users given an API endpoint that returns all friends of a given user.
Given two arrays of strings, A and B.
B contains every element in A, and has one additional member, for example:
* A = ['dog', 'cat', 'monkey] * B = ['cat', 'rat', 'dog', 'monkey']
Write a function to find the extra string in B. Do this in O(n)