Magic Square – IEEXtreme 8.0

Problem Johnny designed a magic square (square of numbers with the same sum for all rows, columns and diagonals i.e. both the main diagonal - meaning the diagonal that leads from the top-left corner towards bottom-right corner - and the antidiagonal - meaning the diagonal that leads from top-right corner towards bottom-left corner). Write a … Continue reading Magic Square – IEEXtreme 8.0

Sum It Up – IEEXtreme 8.0

Problem Minka is very smart kid who recently started learning computer programming. His coach gave him a cyclic array A having N numbers, and he has to perform Q operations on this array. In each operation the coach would provide him with a number X. After each operation, every element of the cyclic array would … Continue reading Sum It Up – IEEXtreme 8.0

Back to Square 1 – IEEEXtreme 8.0

The game “Back to Square 1” is played on a board that has n squares in a row and n-1 probabilities. Players take turns playing. On their first turn, a player advances to square 1.After the first turn, if a player is on square i , the player advances to square i + 1 with … Continue reading Back to Square 1 – IEEEXtreme 8.0

Block Art – IEEEXtreme 9.0

Problem Statement The NeoCubist artistic movement has a very distinctive approach to art. It starts with a rectangle which is divided into a number of squares. Then multiple rounds of layering and scraping occur. In a layering round, a rectangular region of this canvas is selected and a layer of cubes, 1 cube deep, is … Continue reading Block Art – IEEEXtreme 9.0

Digit Fun! – IEEEXtreme 9.0

Problem Statement Recurrence relations are an important tool for the computer scientist. Many algorithms, particularly those that use divide and conquer, have time complexities best modeled by recurrence relations. A recurrence relation allows us to recursively define a sequence of values by defining the nth value in terms of certain of its predecessors. Many natural … Continue reading Digit Fun! – IEEEXtreme 9.0