Given an input like [6, 7, 8, 1, 2]
it should return [6, 7, 8]
.
http://algorithms.tutorialhorizon.com/magic-index-find-index-in-sorted-array-such-that-ai-i/
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.
"aabcccccaaa" -> "a2b1c5a3" and if the compressed string is longer return the original.
For example, when n is 2, the function should print (())
and ()()
, when n is 3, we should get ((()))
, (()())
,
(())()
, ()(())
, ()()()
.
http://blog.gainlo.co/index.php/2016/12/23/uber-interview-questions-permutations-parentheses/
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
https://www.interviewcake.com/question/java/find-unique-int-among-duplicates
http://blog.gainlo.co/index.php/2016/12/02/uber-interview-question-maximum-sum-non-adjacent-elements/
The idea here is to recursively compare max subsets of array
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?
http://blog.cleancoder.com/uncle-bob/2016/06/10/MutationTesting.html
- 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