Showing posts with label glassdoor January 2015 to May 2016 interview algorithms. Show all posts
Showing posts with label glassdoor January 2015 to May 2016 interview algorithms. Show all posts

Friday, May 13, 2016

Some algorithms to study

May 13, 2016

Introduction


Here are some algorithm problems Julia likes to review, what she did is to spend 2 hours to go over Glassdoor.com and go over the interview questions on companies (A, F, L, M, G) from 2016 backward to January 2015.

As a software programmer, Julia knows the value of good thinker in algorithm, problem solving; and write readable, clean code to implement the idea using Java, C++, C#, JavaScript, learn through simple problem solving every day.

Algorithms to review


Put problems in the groups to help study:

Array:

1. Leetcode 23 - Merge K sorted array 

-- read stack, queue, priority queue - definition - May 13, 2016


read through priority queue API document, and understand more if I can.

2. Leetcode 215: Find the kth largest element in an array
http://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array/

Tree problems:

1. Check if given binary tree is a mirror.  
2. Serialize and deserialize the tree
3. Get mirror image of a BST
4. Connect nodes at the same level in a binary tree  
    http://www.geeksforgeeks.org/connect-nodes-at-same-level/   (? bug)
   better one:
http://javabypatel.blogspot.ca/2015/08/connect-nodes-at-same-level-in-binary-tree-using-constant-extra-space.html


Leetcode:

1. Leetcode -- 3 sum 
2. Leetcode 215  - Kth largest elment in the array (quick select)

Linked List:

1. If we have a linked list, and if I give you a number n, then first n node of the linked list should get reversed next n node should as it is, next n should get reversed like wise.

For example, n=3 

String:

1. Given an array of strings,  need to check every string in the array is a palindrome or not.  If it is, we have to print it.  




2. Write a function to determine the longest palindromic substring of a given string.  
3. Find the minimum number of palindromes in a string. 

Sorting:

1. Write a merge sort 

Hashtable:

1. How do you implement a hash table? 

Dynamic Programming:

1. optimal coins
2. Ladder of height 100, u can use jumps {1,2,3} how many different ways can u reach 100.

DFS/ BFS/ Search:

1. Transform a [1,0] matrix grid into matrix grid of manhattan distance between closest 1's  

2. Given a certain number of tasks with specific start and end times, find the maximum number of jobs that can be 
done   

Misc:

1. Check whether rectangle overlap

2. Reverse a matrix in a given sequence

3. There is a 9 digit number, you need to rearrange the number and make just bigger number then this one
    pivot element - google to find a solution

4. There are 9 buckets,Each bucket contains some chocolates(number of chocolates labeled on the bucket), a kid is there, He takes 1 second to eat all the chocolates of 1 bucket and as puts the bucket back, bucket gets filled again with the half chocolate then the original bucket had. kid has n second, find a way in which he can eat max chocolate in n seconds.

5. Find the next largest number.  

6. Solving the jigsaw puzzle. Input is the pieces of the puzzle and a method taking two pieces as input and returning true if they fit.