A. Bumps in the Road

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Your car is old, it breaks easily. The shock absorbers are gone and you think it can handle about 15 more bumps before it dies totally.

Unfortunately for you, your drive is very bumpy! Given a string showing either flat road ( _ ) or bumps ( \(n\) ). If you are able to reach home safely by encountering \(15 bumps or less\), return \(Woohoo!\), otherwise return \(Car Dead\)

Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar:
# INPUT.TXT OUTPUT.TXT
1
n
Woohoo!
2
_nnnnnnn_n__n______nn__nn_nnn
Car Died

B. The Supermarket Queue

Xotira: 32 MB, Vaqt: 1000 ms
Masala

There is a queue for the self-checkout tills at the supermarket. Your task is write a function to calculate the total time required for all the customers to check out!

 

Kiruvchi ma'lumotlar:
  • customers: an array of positive integers representing the queue. Each integer represents a customer, and its value is the amount of time they require to check out.
  • n: a positive integer, the number of checkout tills.
Chiquvchi ma'lumotlar:

The function should return an integer, the total time required.


 

Izoh:

Please look at the examples and clarifications below, to ensure you understand the task correctly :)


 

Misollar:
# INPUT.TXT OUTPUT.TXT
1
1 2 3 4
1
10

C. Switcheroo

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Given a string made up of letters a, b, and/or c, switch the position of letters a and b (change a to b and vice versa). Leave any incidence of c untouched.

Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar:
# INPUT.TXT OUTPUT.TXT
1
aaaa
bbbb
2
bbbb
aaaa

D. Sum of Cubes

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Write a function that takes a positive integer n, sums all the cubed values from 1 to n (inclusive), and returns that sum.

Assume that the input n will always be a positive integer.

Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar:
# INPUT.TXT OUTPUT.TXT
1
1
1
2
2
9

E. Get the Middle Character

Xotira: 32 MB, Vaqt: 1000 ms
Masala

You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters.

Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar:
# INPUT.TXT OUTPUT.TXT
1
middle
dd
2
ozodbek
d

F. Partition Detection

Xotira: 32 MB, Vaqt: 1000 ms
Masala

Can you decide whether or not some walls divide a rectangular room into two or more partitions?

Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar:
# INPUT.TXT OUTPUT.TXT
Kitob yaratilingan sana: 22-Feb-25 08:36