A question from the labratory

Правка en1, от kessido, 2017-09-05 23:44:02

I had this test in my neuroscience laboratory, and we had all sort of brain tissue spread in front of us. Each one had multiple needles attached to it with numbers on them (marking places I needed to answer how they are called). So apparently the lab only had certain needles with certain numbers, and they tried really hard that every tissue will have consecutive numbers on them, but failed really hard...

My question is as follow: You get N needles with numbers on them (an array sized N of ints). the needles a given to you in a unordered way (they come in a box). You get Q brain tissue and each of them needs a certain number of needles on them (an array sized Q of ints).

Question number 1: What is the maximum number of brain tissue you can fill with needles with all consecutive numbers. (2,3,4,5 in a brain tissue with 4 needles needed). Question number 2: What is the maximum number of consecutive numbers you can get ( 2,3,5,6 in a brain tissue with 4 needles needed is 2 consecutive numbers — 3, 6).

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский kessido 2017-09-05 23:44:02 1060 Initial revision (published)