I need help with a script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help with a script

so i have to make a script for school and i am trying to solve this for a week so i came here to ask someone. so for - 6 3 3 8 4 12 2 6 1 10 5 9 11 12 first number (6) is saying how much people is working numbers under first number and next to them (3 8, 4 12...) are the time of work for each guy for example- 3 and 8 means he is working from 3 to 8 so script has to find the longest time when 3 (second number) same people work at the same time and answer for this values is 4 (time) 1 2 4 (people)

29th Oct 2017, 10:46 PM
Breffa
Breffa - avatar
8 Answers
+ 6
Like: 6 2 1-6 3-7 7-9 Create an array Count how many ranges have 1 Count how many ranges have 2 ... Then store in a list. Find the maximum consecutive terms where the value is >=2 That is your time. Then, trace back the time to the people
29th Oct 2017, 11:20 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
you use an array and store how many people work for the whole day, count the maximum number of terms in a row >=3.
29th Oct 2017, 11:14 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Then, you can trace it back to the people
29th Oct 2017, 11:15 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Okay
29th Oct 2017, 11:27 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
i will have to translate what did u exactly mean later but can you give me a Little example?
29th Oct 2017, 11:17 PM
Breffa
Breffa - avatar
+ 3
oh thats nice idea, i will try to make something with this informations but i will type here if i have more troubles okey?
29th Oct 2017, 11:24 PM
Breffa
Breffa - avatar
+ 2
i am not asking for a completed script but for an idea how to make it (sorry for bad english, i am from poland)
29th Oct 2017, 10:47 PM
Breffa
Breffa - avatar
0
i think i got it working, still have to do a calculation about how long they will work but the hard part is done
3rd Nov 2017, 8:23 AM
Breffa
Breffa - avatar