Home / Expert Answers / Computer Science / in-python-pls-not-c-nbsp-thank-you-2-freelancing-platform-a-customer-has-posted-several-web-deve-pa887

(Solved): in python pls (not c) thank you! 2. Freelancing Platform A customer has posted several web deve ...



2. Freelancing Platform
A customer has posted several web development projects on a freelancing platform, and various web dev
Function Description
Complete the function minCost in the editor below.
minCost has the following parameters:
int numProjects

in python pls (not c) 
thank you!
2. Freelancing Platform A customer has posted several web development projects on a freelancing platform, and various web developers have put in bids for these projects. Given the bid amounts and their corresponding projects, what is the minimum amount the customer can pay to have all the projects completed? Note: If any project has no bids, return \( -1 . \) Example numProjects \( =3 \) projects. projectld \( =[2,0,1,2] \) bid \( =[8,7,6,9] \) - projectid[i] is aligned with bid[i] - The first web developer bid 8 currency units for project \( 2 . \) - The second web developer bid 7 currency units for project \( 0 . \) - The third web developer bid 6 currency units for project \( 1 . \) - The fourth web developer bid 9 currency units for project \( 2 . \) There is only one choice of who to hire for project 0 , and it will cost 7 . Likewise, there is only one choice for project 1 , which will cost 6 . For project 2 , it is optimal to hire the first web developer, instead of the fourth, and doing so will cost 8 . So the final answer is \( 7+ \) \( 6+8=21 \). If instead there were \( n=4 \) projects, the answer would be \( -1 \) since there were no bids received on the fourth project. Function Description Complete the function minCost in the editor below. minCost has the following parameters: int numProjects: the total number of projects posted by the client (labeled from 0 to n) int projectld[n]: an array of integers denoting the projects that the freelancers bid on int bid[n]: an array of integers denoting the bid amounts posted by the freelancers Returns: Iong: the minimum cost the client can spend to complete all projects, or \( -1 \) if any project has no bids. Constraints - \( 1 \leq \) numProjects, \( n \leq 5 \times 10^{5} \) - \( 0 \leq \) projectld \( [i]


We have an Answer from Expert

View Expert Answer

Expert Answer


Complete solution with explanation is given below.If you have any doubts ,let me know in comments.If you like my work,please like it(UPVOTE)...Thank you Ans:: def minCost(numProjects,projectId,bid): minimum_prices=[] #list to store minimum_prices
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe