To`griO`rin
Uchta a b c butun sonlar berilgan, ulardan biri kichik, biri o`rtacha qolgani
katta. Agar sonlarning kichigi va o`rtanchasi farqi, o`rtancha va kattasining
orasidagi farqqa teng bo`lsa true qiymat qaytarilsin.
evenlySpaced(2, 4, 6) → true
evenlySpaced(4, 6, 2) → true
evenlySpaced(4, 6, 3) → false
Logic-2
>
makeChocolate
We want make a package of
goal kilos of chocolate. We have
small bars
(1 kilo each) and big bars (5 kilos each). Return
the number of small bars
to use, assuming we always use big bars before small bars. Return -1 if it
can't be done.
shokoladLogikasi
Biz shokoladlardan berilgan goal kilosidagi paket hosil qilmoqchimiz. Bizda
kichik o`ram(1 kilodan) va katta o`ram(5 kilo). Ishlatilgan kichik o`ramlar
sonini qataring, bunda katta o`ramlar kichik o`ramlardan oldin ishlatiladi deb
hisoblansin.
makeChocolate(4, 1, 9) → 4
makeChocolate(4, 1, 10) → -1
makeChocolate(4, 1, 7) → 2