the placement season has begun in a college. there are n number of students outside an interview roomThe placement season has begun in a college. There are N number of students standingoutside an interview room in a line. It is given that a person who goes in first half hashigher chances of getting selected.Each student has a number associated with them known as the problem solvingcapability. The higher the capability, the higher the chances of selection. Now eachstudent wants to know the number of students ahead of him/her who have moreproblem-solving capability than him/her.AFind the number for each student.Input:An integer n, which denotes the number of student present.An array of size n, denoting the problem solving capability of the students.Output:An array of size denoting the required answer for each student
Answers
Answered by
13
Answer:
Input: 6(number of students) {4 , 9 , 5 , 3 , 2 , 10}
Output: {0 , 0 , 1 , 3 , 4 , 0}
Expert's answer
n = int(input('number of student: '))
student = list(map(int, input().split()))
if __name__ == '__main__':
print(0, end=' ')
for i in range(1, n):
t = 0
for j in range(1, i):
if student[j] >= student[i]:
t += 1
print(t, end=' ')
Similar questions