Problem «Even indices» (Easy)
StatementGiven a list of numbers, find and print all the list elements with an even index number. (i.e.
Problem «Even elements» (Easy)
StatementGiven a list of numbers, find and print all elements that are an even number. In this case use a for-loop that iterates over the list, and not over its indices! That is, don't use
Problem «Greater than previous» (Easy)
StatementGiven a list of numbers, find and print all the elements that are greater than the previous element.
Problem «Neighbors of the same sign» (Easy)
StatementGiven a list of numbers, find and print the first adjacent elemets which have the same sign. If there is no such pair, leave the output blank.
Problem «Greater than neighbours» (Easy)
StatementGiven a list of numbers, determine and print the quantity of elemets that are greater than both of their neighbors.
The first and the last items of the list shouldn't be considered because they don't have two neighbors.
Problem «The largest element» (Easy)
StatementGiven a list of numbers. Determine the element in the list with the largest value. Print the value of the largest element and then the index number. If the highest element is not unique, print the index of the first instance.
Problem «The number of distinct elements» (Medium)
StatementGiven a list of numbers with all of its elements sorted in ascending order, determine and print the quantity of distinct elements in it.
Problem «Swap neighbours» (Medium)
StatementGiven a list of numbers, swap adjacent items in pairs (
A, etc.). Print the resulting list. If a list has an odd number of elements, leave the last element in place.
Problem «Swap min and max» (Medium)
StatementGiven a list of unique numbers, swap the minimal and maximal elements of this list. Print the resulting list.
Problem «The number of pairs of equal» (Hard)
StatementGiven a list of numbers, count how many element pairs have the same value (are equal). Any two elements that are equal to each other should be counted exactly once.
Problem «Unique elements» (Hard)
StatementGiven a list of numbers, find and print the elements that appear in the list only once. The elements must be printed in the order in which they occur in the original list.
Problem «Queens» (Hard)
StatementIn chess tt is known that it is possible to place 8 queens on a chess board 8×8 such none of them can attack another. Given a placement of 8 queens on the board, determine if there is a pair of queens that can attach each other on the next move. Print the word
NOif no queen can attack another, otherwise print
YES. The program reads eight coordinate number pairs, each representing 1 of 8 queen position on a standard chess board.
Problem «The bowling alley» (Hard)
StatementIn bowling, the player starts wtih 10 pins at the far end of a lane. The object is to knock all the pins down. For this exercise, the number of pins and balls will vary. Given the number of pins N and then the number of balls K to be rolled, followed by K pairs of numbers (one for each ball rolled), determine which pins remain standing after all the balls have been rolled. The balls are numbered from 1 to N (inclusive) for this situation. The subsequent number pairs, one for each K represent the start to stop (inclusive) positions of the pins that were knocked down with each role. Print a sequence of N characters, where
"I"represents a pin left standing and
"."represents a pin knocked down.