Tuesday, February 4, 2014

How to prepare for an interview - 15

Back to a new set of problems. If you didn't read previous posts start from here. Read previous post here.

Remember you should discuss these solutions with me, and refer if there are mistakes or other good solutions.


141. Use basic arithmetic operations (+-*/) to implement sqrt function.

142. Intersection of n sets without using a hash table.

143. Given a matrix with 1's and 0's, find the number of groups of 1's. A group is defined by horiz/vertically adjacent 1's.

144. Given a file with 3-letter words, print all 3x3 with each row, column and diagonal being one of the words from given file.

145. Given n+1 buckets with n of them with ball inside and move(a,b) function, that moves ball from bucket a to bucket b. Each ball has a different number from [1,n] on it. Move balls, so each bucket has a ball with matching number in it.

146. Find the center of graph(vertex, that is connected with every other vertex, but edges are directed to the center of graph).

147. Insert a node in a singly linked circular list given any node in the list.

148. Given two sorted arrays, please merge them into a single array and still sorted. how to determine the size of array?

149. Multiply two big integers which don't fit into an built-in integer type. How would you represent big numbers as a data structure? Write the function to multiply two big integers.

150. Given set of coins and each coin has its unique probability to be head up, say double[] probs stores the probability values for all coins, print out all different cases and accordingly probability.


Read next post. Share this post to your Facebook, Twitter, LinkedIn.

No comments:

Post a Comment