Блог пользователя dahiyakuldeep304

Автор dahiyakuldeep304, история, 3 года назад, По-английски

Can anyone please tell me how we approach to this problem.

A drawer contains socks of n different colours. The number of socks available of ith colour is given by a[i] where a is an array of n elements. Tony wants to take k pairs of socks out of the drawer. However, he cannot see the colour of the sock that he is picking. You have to tell what is the minimum number of socks Tony has to pick in one attempt from the drawer such that he can be absolutely sure, without seeing their colours, that he will have at least k matching pairs.

question link-> https://practice.geeksforgeeks.org/problems/620fb6456d6515faddd77050dfbf2821d7a94b8a/1/?track=30-DOC-day-4&batchId=320

Thanks in advance.

  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

The link wont open