Skip to content

Instantly share code, notes, and snippets.



Last active Mar 21, 2017
What would you like to do?
[RC Diary] Mock interviews (-94)

[RC Diary] Mock interviews (-94)

Mock interviews

Longest increasing subarray

Given an input like [6, 7, 8, 1, 2] it should return [6, 7, 8].

magic index problem

A good take away lesson from this exercise was that if you have to deal with array splitting (like in binary search for example), you might want to keep the original array and pass around boundaries indexes, so it's easier not to lose the position of the magic index.

String compression

"aabcccccaaa" -> "a2b1c5a3" and if the compressed string is longer return the original.

Print all possible n pairs of balanced parentheses.

For example, when n is 2, the function should print (()) and ()(), when n is 3, we should get ((())), (()()), (())(), ()(()), ()()().

Pseudocode for this could be

f(n) = for i in range(n):
           for l in f(i):
               for r in f(n-i-1):
                   results += "(" + l + ")" + r
       return results

Find unique int among duplicates

The idea here is to recursively compare max subsets of array

Writing about testing

The description should be something like "Different types of tests, how to create and run good tests, best practices, available tools for testing".

The important things to focus on IMHO are

  • why should I test? And,
  • how do I write good effective tests?

One should test to reach the objective of pushing into production and then leaving to have lunch. One should arrive to this kind of confidence in their architecture and testing solutions.

To have that tests should be written, and a continuous delivery process started. But

  • how good does a test should be written to be good enough?
  • how many tests is enough?
  • have I covered all the branches?

Read Uncle Bob take on mutation testing


  • Cerebro
  • prepare test talk "Different types of tests, how to create and run good tests, best practices, available tools for testing" for March 1 at 2pm
  • project lamp
  • still need some attention needed for timsort, radix sort, dijkstra algo
  • chapter 1 and 2 of the little schemer in Clojure
  • reflect on first two weeks of RC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment