Question: Ascentx | Online Round | On-Campus | 03-Sep-2020
2
Entering edit mode

CTC 8 LPA
Intern Stipend 20k monthly



Online Round had 2 coding questions.

First Question

Given a list of words you are allowed to rotate each word exactly K times.
Here rotations mean rotate left to right by shifting each character towards right in a cyclic manner.
Find the number of words which remain unchanged after exactly K such operations.

Second Question

World War II involved the usage of a lot of ships. In order to win you had to align the ships in a specific order.
The order is ->
1. There are several layers of ships
2. Each ship has a value (v) associated with it.
3. Each ship is followed by (v*v + 1)%M distinct ships in the next layer having values from 0 to [(v*v + 1)%M] - 1
4. In the first layer there is only one ship with value (v) =2.
Find the total no of ships in all the layers modulo M.

ADD COMMENTlink 4.2 years ago Shubhendu Goel • 450

Login before adding your answer.

Similar Posts
Loading Similar Posts