finished brute force implementation
added tests
simple improvements of algorithm