techpuzzl.wordpress.com
Big Oh Notation – Best Explanation Ever | techpuzzl
https://techpuzzl.wordpress.com/2012/04/29/big-oh-notation-best-explanation-ever
Technology, Puzzles, everything you want for an interview. Permutations of a string. Big Oh Notation – Best Explanation Ever. 8211; coupled with a slightly complex wikipedia article makes a lot of sense. Leave a Reply Cancel reply. Enter your comment here. Fill in your details below or click an icon to log in:. Address never made public). You are commenting using your WordPress.com account. ( Log Out. You are commenting using your Twitter account. ( Log Out. Notify me of new comments via email.
techpuzzl.wordpress.com
Reverse Linked Lists – phew! | techpuzzl
https://techpuzzl.wordpress.com/2011/06/07/reverse-linked-lists-phew
Technology, Puzzles, everything you want for an interview. Reverse a Linked List in groups of given size. Longest increasing subsequence →. Reverse Linked Lists – phew! I am not really a fan of this question but it seems to be quite a favorite question during technical interview. So, lets discuss reversing a linked-list problem at length. Basically there are two methods of reversing a linked list – iterative and recursive. Lets discuss the iterative method :. The logic looks like this :. ReverseRecursive...
techpuzzl.wordpress.com
Longest increasing subsequence | techpuzzl
https://techpuzzl.wordpress.com/2011/12/10/longest-increasing-subsequence
Technology, Puzzles, everything you want for an interview. Reverse Linked Lists – phew! Permutations of a string →. Has been a classic Dynamic Programming problem. O(N 2) has been around for a while but more interesting is the following O(n log n) solution. For example : We have sequence : 1,8,2,7,3,6,4,5 which has the longest increasing subsequence : 1,2,3,4,5. How to arrive at this in O(n log n)? The O(nlogn) algorithm works as follows:. Lets walk through the solution. Try adding A[3]=2 to the list.
techpuzzl.wordpress.com
techpuzzl | Technology, Puzzles, everything you want for an interview. | Page 2
https://techpuzzl.wordpress.com/page/2
Technology, Puzzles, everything you want for an interview. Newer posts →. Mastering Programming Interview Questions. Http:/ courses.csail.mit.edu/iap/interview/materials.php. 8211; Pure Gold. Also, a must read – http:/ news.ycombinator.com/item? Posted in Interview Question. Talks about the difficulties of a phone interview. Posted in Interview Question. Write a program to shuffle an pack of cards in the most efficient way. This question can be asked in several flavors. Continue reading →. We can travers...
techpuzzl.wordpress.com
Reverse a Linked List in groups of given size | techpuzzl
https://techpuzzl.wordpress.com/2011/06/07/reverse-a-linked-list-in-groups-of-given-size
Technology, Puzzles, everything you want for an interview. Intersection of two Arrays. Reverse Linked Lists – phew! Reverse a Linked List in groups of given size. Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Inputs: 1- 2- 3- 4- 5- 6- 7- 8- NULL and k = 3. Output: 3- 2- 1- 6- 5- 4- 8- 7- NULL. Inputs: 1- 2- 3- 4- 5- 6- 7- 80- NULL and k = 5. Output: 5- 4- 3- 2- 1- 8- 7- 6- NULL. Algorithm: reverse(head, k). Leave a Reply Cancel reply. Address never ...
techpuzzl.wordpress.com
Permutations of a string | techpuzzl
https://techpuzzl.wordpress.com/2012/02/15/permutations-of-a-string
Technology, Puzzles, everything you want for an interview. Big Oh Notation – Best Explanation Ever →. Permutations of a string. Lets take this old question and discuss a very elegant solution to it. For a string “ABC”, we have these permutations : “ABC,ACB,BAC,BCA,CAB,CBA”. First, lets look at this elegant code below and try to find out how it works. Note that line :. System.out.println(prefix “—“ s);. Is just to debug this. The output is very interesting. Leave a Reply Cancel reply. Zubiedoo on 25 Horses.
techpuzzl.wordpress.com
Upnishad | techpuzzl
https://techpuzzl.wordpress.com/author/upnishad
Technology, Puzzles, everything you want for an interview. Big Oh Notation – Best Explanation Ever. 8211; coupled with a slightly complex wikipedia article makes a lot of sense. Permutations of a string. Lets take this old question and discuss a very elegant solution to it. For a string “ABC”, we have these permutations : “ABC,ACB,BAC,BCA,CAB,CBA”. First, lets look at this elegant code below and try to find out how it works. Note that line :. System.out.println(prefix “—“ s);. Is just to debug this.
techpuzzl.wordpress.com
Intersection of two Arrays | techpuzzl
https://techpuzzl.wordpress.com/2011/06/07/intersection-of-two-arrays
Technology, Puzzles, everything you want for an interview. Reverse a Linked List in groups of given size →. Intersection of two Arrays. Very simple algorithm but somehow interviewers love this. So, here it is:. For example, if the input arrays are:. Arr1[] = {1, 3, 4, 5, 7}. Arr2[] = {2, 3, 5, 6}. Then your program should print Intersection as {3, 5}. For Intersection of two arrays, print the element only if the element is present in both arrays. 2) If arr1[i] is smaller than arr2[j] then increment i.