+ 5
*DAILY CHALLENGE* : You're unemployed and looking for new jobs. You earn 300$ per job. How much money can you earn in a year?
A job has an id, start-month and end-month: ["x",0,3] means job x goes from january until (excluding) april! These are the jobs you found for 2018: jobs = [ ["a",8,11],["b",2,3],["c",0,4],["d",1,2],["e",4,8],["f",7,9] ] What is the maximum profit? Print it to the screen! HINT: 1) 1 job = 300$, 2 jobs = 600$ ... (NOT monthly) 2) WILL BE UPLOADED LATER ;) GOOD LUCK & HAVE FUN !!!! https://www.sololearn.com/Discuss/2968640/?ref=app
25 Antworten
+ 3
I went for the jobs that finishes the earliest.
There is an issue where it picks the job which takes the longest when given something like ( ( "a", 1, 5 ), ( "b", 3, 5) ).
But hey, same payment... Thats what it is all about ^^, some people don't like to get bored I guess.
https://code.sololearn.com/cMMSkh4udB3n/?ref=app
+ 3
Let's be greedy! 😏💰
+ 3
@Sreeiith I believe there can be only ONE active job on any month. That means you can't take both x and y job as both durations are overlapping with each other.
+ 2
here is the most detailed version...
WITH EVERY BIT OF DETAILS
INCLUDED##
1) 15 JOBS...IN TOTAL...a,b,c,d,e,f,g,h,i,j,k,l,m,n,o
2) every step of sorting is included
https://code.sololearn.com/cPvev0pgl3K9/?ref=app
+ 2
6 job x $300 ea = $1800 would be max profit.
Is there any constraint related to month? Like 1 job in a month?
+ 2
###CLEAR IDEA ABOUT THE CHALLENGE###
***TO ALL WHO PARTICIPATES*****
1) 12 MONTHS ARE THERE
2) A JOB CAN START AT ANY MONTH END AT ANY...IN A YEAR...(.NOT LIKE SEPT 2017 TO FEB 2018)
3) IRRESPECTIVE OF THE TIME OF A JOB...
WHETHER ITS 1,2,5,7,8 etc MONTHS...WHATEVER...1 JOB=300$
4) THE CHALLENGE JULIAN GAVE...
IS TO MAKE AN ALGORITHM....[.WITH CERTAIN NO. OF JOBS AVAILABLE (KNOWN)...] THAT WILL COMPUTE ALL THE PATHS OR CHOICES ANY ONE CAN MAKE...
5) SUPPOSE THERE ARE 14 JOBS AVAILABLE...U COMPUTE ALL THE PATHS U CAN CHOOSE FOR A YEAR TO EARN MONEY..
6) THEN YOU FIND THE MAXIMUM -MONEY- PATH OR PATHS...
7) AT LAST YOU SHOWS THE MINIMUM TIME-MAX-MONEY PATH (IN THE OUTPUT)
EG-> SUPPOSE MAX EARNING PATH IS 1500$
(theres 2 situation -can be more)
A PATH 8 MONTHS 5 JOBS MEANS 1500$
ANOTHER PATH 10 MONTHS 5 JOBS..AGAIN 1500$
NOW 8 months 5 jobs is profitable right??
so your code output will be this...
#*** hope this is helpful & clear***#
u can see my program above in post as a general example..
+ 1
https://code.sololearn.com/c28O0OKV5sD7/?ref=app
I think you shouldn't have given the hint :/
+ 1
12 jobs you can take is the max, ain't it ?
+ 1
#@@sreejit and zyphyr koo@@@@
please read my post(big post about the idea of this challenge)...and also check my program..."statistical.job.version#final"
+ 1
mine, with d,1-2 b,2-3 and f,7-9
1200$ on 4 working months
https://code.sololearn.com/Wa8wdQMDbF3x/?ref=app
0
["x",3,7]
means april-may -june-july......
not aug right???????
300$ each job means wht...
yearly...or monthly???
0
@sayan chandran
0 = jan, 1 = feb, 2 = mar, 3 = apr, 4 = jun, 5 = jul, 6 = aug, 7 = aug, 8 = sep, 9 = oct, 10 = nov, 11 = dec
yes ["x",3,7] means april-may-june !
300$ per job. not monthly/yearly...
0
@sayan chandra
the problem including monthly calculation is a different problem... ;)
so please delete the last post!!! (might confuse others)
0
ya...i know...
i just created another challenge...in my 1st code##😂😂😂😂😂😂
0
@@julian
please check once the 2nd version..
i included path with total months and total jobs####
so that one can see the difference actually
0
https://code.sololearn.com/cUjd610ot9au/?ref=app
My final submission, everything work this time
0
what is no. job that can be done at once
is there any limit
eg [x,3,7] [y,4,6]
is it possible to complete both jobs
if yes why can't you do all the jobs
0
This is my solution to the challenge ! :) I guess for more jobs it can get too long to execute but here it seems to work :)
https://code.sololearn.com/cJCt9TxK2UVH
0
here is new challenge...
https://www.sololearn.com/discuss/664933/?ref=app
0
vote for your favorite coding language:
https://code.sololearn.com/WJqfkcTEguBe/?ref=app