Update Problem 2.R

Added some timings and alternative algo