Indeed Interview Question for SDE-2s
- 0of 0 votes
You are given N records. The content of the i-th record is represented by a string Si. These records are managed in pages, as follows:- neer.1304 August 15, 2019 in United States
• The first page: contains the first, ..., K-th records.
• The second page: contains the (K+1)-th, ..., 2K-th records.
• The third page: contains the (2K+1)-th, ..., 3K-th records.
• The ceil(N⁄K)-th page: contains the ((ceil(N⁄K)−1)K+1)-th, ..., N-th records.
Here, ceil(X) represents the smallest integer not less than X. Print the contents of the records contained in the M-th page, in the order given.
• 1≤|Si|≤100 (1≤i≤N), where |S| is the length of S.
• Si is a string consisting of lowercase English letters.
Input is given from Standard Input in the following format:
N K M S1 S2 : SN
Print the contents of the records contained in the M-th page, in the order given. Use L lines, where L is the number of records that should be printed. The i-th line (1≤i≤L) should contain the content of the i-th record contained in the M-th page.
Sample Input 1
5 2 2
Sample Output 1
• The first page contains the first and second records, which are aaa and bbb.
• The second page contains the third and fourth records, which are ccc and ddd.
• The third page contains the fifth record, which is eee.
Since the second page is requested, we should print ccc in the first line and ddd in the second line.
Sample Input 2
7 4 2
Sample Output 2
| Report Duplicate | Flag | PURGE
Indeed SDE-2 Algorithm
Open Chat in New Window