Похожие чаты

Hey guys can anyone assist me in solving this algorithm,

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)
*/`

2 ответов

35 просмотров

What course is this?

these aren't large numbers, start with brute force

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта