Computer Science, asked by jainharshita523, 2 months ago

Blocks
Enable Split Screen
Flag
Problem Description - 1/2
There are N floating blocks in a pond and they are arranged in a straight line. Each of these blocks has a value associated with them which is written on top of them
After every 1 minute, blocks at the odd positions get submerged underwater. You must shift the remaining blocks to one position left to fill in the emptied space. This
process is repeated till only one block is left floating.
You must return the value of the last block which is left floating.
Note: The position index starts with 1 and blocks are numbered from 1 to N in the left to right direction. It is given that N is always greater than 1
Function Description
Complete the blockNum function in the editor below. It has the following parameter(s):
Description
Name
Type
Parameters
INTEGER
N
number of blocks floating in a pond initially
3
Return
The function must return an INTEGER denoting the value of the last block which is left floating..
Constraints

• 15N<1045
Input Format For Custom Testing
12
The first line contains an integer, N, denoting the number of blocks floating in a pond initially.
>
15
Sample Cases​

Attachments:

Answers

Answered by narutokakashi
0

Answer:

ggffffffffffffffccccccccccccccg3

Similar questions