A. Bumps in the Road
Xotira: 32 MB, Vaqt: 1000 msYour 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\)
# | 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 msThere 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!
- 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.
The function should return an integer, the total time required.
Please look at the examples and clarifications below, to ensure you understand the task correctly :)
# | INPUT.TXT | OUTPUT.TXT |
---|---|---|
1 |
1 2 3 4 1 |
10 |
C. Switcheroo
Xotira: 32 MB, Vaqt: 1000 msGiven 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.
# | INPUT.TXT | OUTPUT.TXT |
---|---|---|
1 |
aaaa |
bbbb |
2 |
bbbb |
aaaa |
D. Sum of Cubes
Xotira: 32 MB, Vaqt: 1000 msWrite 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.
# | INPUT.TXT | OUTPUT.TXT |
---|---|---|
1 |
1 |
1 |
2 |
2 |
9 |
E. Get the Middle Character
Xotira: 32 MB, Vaqt: 1000 msYou 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.
# | INPUT.TXT | OUTPUT.TXT |
---|---|---|
1 |
middle |
dd |
2 |
ozodbek |
d |
F. Partition Detection
Xotira: 32 MB, Vaqt: 1000 msCan you decide whether or not some walls
divide a rectangular room
into two or more partitions?
# | INPUT.TXT | OUTPUT.TXT |
---|