Added fastest_way method using dynamic programming