refactored prob1 and added brute force method
solved prob2 in constant time