Solve 3 coding question, PHP and JS/JQuery

Ditutup Disiarkan 3 tahun lepas Dibayar semasa penghantaran
Ditutup Dibayar semasa penghantaran

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!

PHP JavaScript jQuery / Prototaip AJAX CSS

ID Projek: #29322394

Tentang projek

2 cadangan Projek jarak jauh Aktif 3 tahun lepas

2 pekerja bebas membida secara purata ₹1425 untuk pekerjaan ini

ncertsolution00

dear hiring manager i will solve all these three questions for you in php. text me in the chat box for further discussion. thanking you. Ayush

₹1800 INR dalam 2 hari
(1 Ulasan)
0.0
geniusdevl786

i am a fully skilled web developer. i can create your required web application. so you can trust me

₹1050 INR dalam sehari
(0 Ulasan)
0.0