Question: TCS NQT Practice Test - IT Section Advanced Coding - 1 Note:You need to press Final Submit for your program to be considered for evaluation.

TCS NQT Practice Test - IT
Section
Advanced Coding -1
Note:You need to press "Final Submit" for your program to be considered for evaluation. The program w due to time out.
John is hosting a celebration for the grand opening of his new startup and has invited all of his N colleagues. Each colleague is assigned a unique index from 1 to N, and they are known to each other by their respective salaries, represented by integer values. John needs to arrange tables to accommodate everyone, but he wants to do so while minimizing costs. Each table has a seating capacity, and renting each table costs K. However, there's a concern that colleagues with the same salary might get into arguments if seated together.
To minimize costs and avoid conflicts, John wants to find the optimal arrangement with the smallest possible inefficiency. Inefficiency here is defined as the sum of the cost of tables plus the total number of people involved in conflicts. Given the number of colleagues, N, and their salaries represented by array s[], John seeks to determine the optimal inefficiency.
Sample Input:
5,1000,1500,1200,1000,1000,1
When the above line is given as sample input,
N=5
Salaries: 1000,1500,1200,1000,1000
Cost of each table, K=1
Sample Output:
Program Editor
1b
TCS NQT Practice Test - IT Section Advanced

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!