Sunday, February 2, 2014

How to prepare for an interview - 11

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.
Problems

101. Given an array of distinct integers, and a target integer t, compute all of the subsets of the array that sum to t, where order matters.


102. Given an undirected graph and a node, modify the graph into a directed graph such that, any path leads to one particular node.


103. Reverse an array.


104. Two texts are considered to "match" if they have a common substring of at least length n. Describe an algorithm to determine if two strings are matches.


105. Given N credits cards, determine if more than half of them belong to the same person/owner. All you have is an array of the credit card numbers, and an api call like isSamePerson(num1, num2).


106. Compress a string.


107. Given an integer, return all sequences of numbers that sum to it. (Example: 3 -> (1, 2), (2, 1), (1, 1, 1)).


108. Given an unsorted array, extract the max and min value using the least number of comparison.


109. Max sum of adjacent value combination in an array.


110. Provided a phone number (654-876-0987), return all possible strings that the phone number could represent if 2 -> {A, B, C}, 3 -> {D, E, F}, and so on.


Done.

Read the next post. Share it on Facebook, Twitter, LinkedIn.

No comments:

Post a Comment