I am currently doing a course on udemy
`/*
Problem 1: Given a starting point (a,b) and a destination point (x,y) and the rule that from any point, you have two possible steps you can make: (a,b) --> (a+b,b) or (a,b+a)
What is the least number of steps required to get from (a,b) to (x,y)? If it's impossible to reach the finish array then print 'impossible'.
E.g., write the function
least_steps(start, finish)
With test cases
least_steps([1,1], [4,7]) == 4
least_steps([1,1], [100,123]) == 14
least_steps([1,1], [123,122]) == 122
least_steps([1,1], [3, 241]) == 82
least_steps([1,1], [44, 143]) == 'impossible'
---> for example the first problem would use these steps
starting from this point (1,1) going to point (4,7)
#1 (1, 2)
#2 (1, 3)
#3 (4, 3)
#4 (4, 7)
*/`
What course is this?
these aren't large numbers, start with brute force
Обсуждают сегодня