Похожие чаты

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 ответов

14 просмотров

What course is this?

these aren't large numbers, start with brute force

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

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

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
I love the passion, really do. I do think this is being blown way out of proportion. We are not deleting our Telegram or not allowing you to talk about anything you want, a...
Mike Herron
3
Did you guys see the latest tweet from TonGifts? 🚀
Mike
44
Hey guys, did you see the latest announcement about $FUN? 🔥
Brian
21
Question: when will have qnt holders a tool to stake tokens in lcx? Answer, Verdian: yes soon.
David Ch
14
Did kadena deliver anything on time?
Femboi Uwu
23
Коллеги, доброе утро. Запустил на удаленном хосте приложение (ручками зашел туда по ssh и запустил, не командой удаленно). Создал потом ssh-туннель, и с моей машины приложение...
Δημήτηρ
9
Всем привет, подскажите/посоветуйте пожалуйста. Фаердак компоненты, имею одно место где бизнес хочет видеть при открытии формы список всех клиентов, это порядка 30к. Мои дово...
Sasha Sch
14
Hey guys Long term LINK holder here (All in for the past 5 years). I actually tried not to pay too much attention anymore and just let my thesis play out. But seeing that fili...
Koala Chud
9
Ребят, если кто в курсе - скажите, а в загранке такое же засилье маркетплейсов? или там простые сермяжные интернет-магазины живут попроще?
Андрей [aharito] Харитонов
14
Карта сайта