Computer Science, asked by ashwaniMishraji, 2 months ago

Before the prayer assembly begins, thestudents of different classes stand randomly in
a single line. Often they become noisy. To
maintain silence during the prayer assembly,
the teacher tells them to stand in a particular
sequence. The sequence is such that there are
at least N students of other classes standing
between students of the same class.
La ca N A WNA
Write an algorithm to output the final
sequence in which the students will stand. If no
such sequence is possible then output -1. If
more than one sequence is possible, then
output the lexicographically smallest string.
het​

Answers

Answered by ramamondal42695
0

Answer:

Before the prayer assembly begins, the

students of different classes stand randomly in

a single line. Often they become noisy. To

maintain silence during the prayer assembly,

the teacher tells them to stand in a particular

sequence. The sequence is such that there are

at least N students of other classes standing

between students of the same class.

La ca N A WNA

Write an algorithm to output the final

sequence in which the students will stand. If no

such sequence is possible then output -1. If

more than one sequence is possible, then

output the lexicographically smallest string.

het

Similar questions