All Questions
6 questions
2
votes
5
answers
299
views
Sum of bitwise XOR of each subarray weighted by length
here is the problem statement
You are given an array a of length n consisting of non-negative integers.
You have to calculate the value of \$\sum_{l=1}^n \sum_{r=l}^n f(l,r)\cdot (r - l + 1)\$ where \...
1
vote
0
answers
96
views
selecting 5 best players out of 2 team
Let us assume that we need to develop an application which can select best 11 players to score maximum points. The application will select the best players after completion of a match. The rules are ...
3
votes
3
answers
2k
views
Tower Hopper problem recursive approach
The Tower Hopper problem gives us an array of values representing heights that express how far we can jump from a certain tower, and asks whether there's a way to get from ...
8
votes
3
answers
305
views
Splitting a rectangular chocolate bar
I'm having trouble with my school homework. I have a chocolate bar that consists of either black, white or black&white (mixed) squares. I'm supposed to divide it in two groups, one that has only ...
3
votes
2
answers
160
views
Count the number of ways to obtain a sum, with consecutivity restriction
A cricketer can score 1, 2, 4 or 6 in a ball. Find in how many ways the player can score a total of "n" runs without hitting 3 consecutive boundaries. Note: Scoring 4 or 6 is considered as a boundary. ...
8
votes
1
answer
169
views
Reading, processing and counting an array setting limits
Last weekend my teacher asked me to create code to solve a problem:
Giving a dynamic array, we want to pass the array elements from a file. The first number in the file N gives us the array length. ...