CodingBat: Logics



Yüklə 275,84 Kb.
Pdf görüntüsü
səhifə10/13
tarix05.04.2023
ölçüsü275,84 Kb.
#93743
1   ...   5   6   7   8   9   10   11   12   13
CodingBat Logics (1)

cheklanganYig`indi 


Ikkita manfiy bo`lmagan a va b son berilgan agar ularning 
yig`indisi raqamlar soni a ning raqamlar soniga teng son chiqsa 
yig`indini qaytaring. Agar katta bo`lsa a sonini o`zini qaytaring.
sumLimit(2, 3) → 5 
sumLimit(8, 3) → 8 
sumLimit(8, 1) → 9 
Logic-2
 > 
makeBricks
prev |
next
|
chance
 
We want to make a row of bricks that is goal inches long. We have a 
number of small bricks (1 inch each) and big bricks (5 inches each). 
Return true if it is possible to make the goal by choosing from the given 
bricks. This is a little harder than it looks and can be done without any 
loops.
G`ishtQuying
Biz goal qiymati uzunligidagi g`isht qatori hosil qilmoqchimiz. Bizda bir 
nechta kichkina g`ishtlar(har biri 1 inch) va katta g`ishtlar(har biri 5 inch). 
Agar berilgan g`ishtlardan foydalanib keltirlgan goaldagi g`isht qatorini 
quyishning iloji bo`lsa true qiymat qayatarilsin. 
makeBricks(3, 1, 8) → true 
makeBricks(3, 1, 9) → false 
makeBricks(3, 2, 10) → true 
Logic-2
 > 
loneSum
Given 3 int values, a b c, return their sum. However, if one of the values 
is the same as another of the values, it does not count towards the sum. 
Yolg`izYig`indi 
Uchta butun a,b,c sonlar berilgan, ularning summasini qaytaring. Agar bitta 
son qolgan ikki sonning biriga teng bo`lsa bu sonlar yig`indida hisoblanmaydi. 
loneSum(1, 2, 3) → 6 
loneSum(3, 2, 3) → 2 
loneSum(3, 3, 3) → 0 
Logic-2
 > 
luckySum
 


omadliYig`indi 
Given 3 int values, a b c, return their sum. However, if one of the values 
is 13 then it does not count towards the sum and values to its right do 
not count. So for example, if b is 13, then both b and c do not 
count.omadliYigindi 

Yüklə 275,84 Kb.

Dostları ilə paylaş:
1   ...   5   6   7   8   9   10   11   12   13




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin