added bruteforce algorithm