In this series of posts i will talk about How to prepare for an interview, by interview i mean (Google, Facebook, Linkedin, Amazon, Imo.im, and Pocket Gems ...) interviews.
In this series i will only talk about the technical part of interview preparation. You will find lots of interview problems which i collected from lots of references like:
- Cracking an interview book
- Hacking a Google interview handouts
In this series i will solve in each post about 10 problems, may be more or less based on the difficulty of each problem then write my own solution for each problem. To get the best out of this training you should think about each problem, code it, test it and then check my solution, In case you couldn't solve the problem feel free to read/think/test/recode/discuss my solution.
Remember you should discuss these solutions with me, and refer if there are mistakes or other good solutions.
Note: I will use C++ to solve all of the coming problems, feel free to use other programming languages.
1. Determine if a string has all unique characters.
2. Reverse a string in place.
3. Remove duplicates in a string in place.
4. Write a method to decide if two strings are anagrams or not.
5. Given an image represented by N*N matrix can you rotate it 90 degrees in place.
6. Write an algorithm such that if an element in an M*N matrix is 0, its entire row and column is set to 0.
7. Assume you have a method isSubstring which checks if one word is a substring of another string. Given two strings s1, and s2. write code to check if s2 is a rotation of s1 using only one call to isSubstring (i.e., “waterbottle” is a rotation of “erbottlewat”).
8. Write a function that (insert, remove, search, print, reverse, removeDuplicates) a linked list.
9. Write a method to delete a node in the middle of a linked list given only access to that node:
Input: The node 'c', from the linked list a->b->c->d->e
Output: Nothing is returned but the linked list becomes: a->b->d->e
10. You have two numbers represented by a linked list, where each node contains a single digit. The digits are sorted in reverse order, such that the 1's digit is at the head of the list. Write a function that adds two numbers and returns the sum as a linked list.
Input: (3 -> 1 -> 5) + (5 -> 9 -> 2)
Output: 8 -> 0 -> 8
To discuss and solve more problems please read the next post.
a very nice pack of questions here :) ...ReplyDelete
Did you make through the final interview and have been accepted?
Thanks, Go and check the next post, and wait for more posts this series will be very long isA ..ReplyDelete
About your questions yes i've made interviews with all of the companies mentioned above and each one has a story :) .. ed3ely b2ah :)
Can u explain the 6th solution in full detail?ReplyDelete
It resets all the elements of rows and columns that has an element equals 0Delete
Can you please give a small test case for the 6th question? Just to make sure the question is what i think. Thanks in advance :)ReplyDelete
Tks very much for your post.ReplyDelete
Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.
You also find all interview questions at link at the end of this post.
Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:
I really appreciate your efforts , do share more content like this content writing coursesReplyDelete
I found it very interesting website thank you for sharing with us free logo makerReplyDelete