Programming Exercises

Connected Threads

Given N threads with different lengths, connect the ropes into one thread.

40
minutes

Smaller Primes

Determine all the prime numbers smaller than a given input value.

20
minutes

Digit Power

Determine the last digit of the 2^n number, where n is a given integer.

20
minutes

Repeating Numbers

Find the numbers that are repeating in an array containing numbers from 1 to 1000.

30
minutes

Power of 2

Write an algorithm to check if a number is a power of 2.

20
minutes

Second Number

Find the second largest number in a vector of n numbers.

20
minutes

Distinct Numbers

Given a vector of n positive integers. Write an algorithm that determines whether there are any 2 equivalent elements in the vector.

20
minutes

Sum of Digits

Determine the sum of the digits that compose a given number.

20
minutes

Check Digit

Determine the check digit for a given number n.

20
minutes

Maximum Vector

Given 2 arrays of integer numbers, with m and n elements each, check if the maximum element from the first array is found in the second one.

20
minutes