Find Jobs
Hire Freelancers

Solve 3 coding question, PHP and JS/JQuery -- 2

₹600-1500 INR

Închis
Data postării: circa 3 ani în urmă

₹600-1500 INR

Plata la predare
Hi, I am looking for some one to provide me a working code for the following questions Question no 1------------------------------------------------------------------------------------------------------------------------------ Using PHP An investor has saved some money and wants to invest in the stock market. There are a number of stocks to choose from, and they want to buy at most 1 share in any company. The total invested cannot exceed the funds available. A friend who is a stock market expert has predicted the values of each stock after 1 year. Determine the maximum profit that can be earned at the end of the year assuming the predictions come true. Example saving = 250 currentValue = [175, 133, 109, 210, 97] futureValue = [200, 125, 128, 228, 133] To maximize profits, the investor should buy stocks at indices 2 and 4 for an investment of 109 + 97 = 206. At the end of the year the stocks are sold for 128 + 133 = 261, so total profit is 261 - 206 = 55. Function Description Complete the function selectStock in the editor below. The function should return an integer that denotes the maximum profit after one year. selectStock has the following parameter(s): int saving: amount available for investment int currentValue[n]: the current stock values int futureValue[n]: the values of the stocks after one year Constraints 0 < n ≤ 100 0 < saving ≤ 30000 0 ≤ currrentValue[i], futureValue[i] ≤ 300 Question no 2------------------------------------------------------------------------------------------------------------------------------ Using javascript and jQuery Fountains are installed at every position along a one-dimensional garden of length n. Array locations[] represents the coverage limit of these fountains. The ith fountain (where 1 ≤ i ≤ n) has a coverage limit of locations[i] that can range from the position max( (i - locations[i]), 1 ) to min( (i + locations[i] ), n ). In other words, the fountains do not reach outside the boundaries of the garden. In the beginning, all the fountains are switched off. Determine the minimum number of fountains that need to be activated to cover the n length garden by water. Example n = 3 locations[] = {0, 2, 1}, then For position 1: locations[1] = 0, max( (1 - 0), 1) to min( (1+0), 3) gives range = 1 to 1 For position 2: locations[2] = 2, max( (2 - 2), 1) to min( (2+2), 3) gives range = 1 to 3 For position 3: locations[3] = 1, max( (3 - 1), 1) to min( (3+1), 3) gives range = 2 to 3 fountainActivation has the following parameter: int locations[n]: the fountain locations Returns int: the minimum number of fountains that must be activated Constraints 1 ≤ n ≤ 105 0 ≤ locations[i] ≤ min( n,100) (where 1 ≤ i ≤ 105) Question no 3------------------------------------------------------------------------------------------------------------------------------ Using javascript ReGex Use a regular expression to differentiate between items that are good to take on a trip (true) and those that are bad to take on a trip (false). Here is a list of items considered good to take on a trip: matches jacket blanket compass pot hat screwdriver fork book penknife Here is a list of items considered bad to take on a trip: smartphone sword axe radio walkman tv camera boombox skateboard smartwatch Write a regular expression with a maximum length of 25 characters to match the input string only if a good item is given in the input. If the expression is correct, the pattern matcher will return true for items on the good list and false for items on the bad list. Replace the blank (_________) in the stub code with your RegEx string. Constraints All strings will be from one of the two lists. The maximum length of your RegEx must no be more than 25 characters Sample Input STDIN Function ----- ----- 1 → number of test cases T = 1 jacket → a string from the given lists Sample Output true Explanation 'jacket' is in the list of good items, so return true. Thanks!
ID-ul proiectului: 29323995

Despre proiect

Proiect la distanță
Activ: 3 ani în urmă

Vrei să câștigi bani?

Avantajele de a licita pe platforma Freelancer

Stabilește bugetul și intervalul temporal
Îți primești plata pentru serviciile prestate
Evidențiază-ți propunerea
Te înregistrezi și licitezi gratuit pentru proiecte

Despre client

Steagul INDIA
BENGALURU, India
5,0
4
Metoda de plată a fost confirmată
Membru din nov. 12, 2017

Verificarea clientului

Mulțumim! Ți-am trimis prin e-mail linkul pe care trebuie să-l accesezi pentru a revendica creditul gratuit.
A apărut o eroare la trimiterea e-mailului. Încearcă din nou.
Utilizatori înregistrați Totalul proiectelor postate
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Se încarcă previzualizarea
S-a oferit permisiunea de depistare a locației.
Ți-a expirat sesiunea pentru conectare sau te-ai deconectat. Conectează-te din nou.