What is the runtime of your solution?
sizes = {25,50,60,120} maximum = 130
Your method will return 120 since all other combinations of components
either produce less code, or are greater than the 130 limit. If no
software can be built return -1.
Constraints
Examples
{1,2,3,4,5}
15
Returns: 15
All of the code can be used
{20,40,45,60,60}
86
Returns: 85
Using 40 and 45 will produce the largest amount of code.
{89,73,20,5,5,10000,900}
995
Returns: 994
{122}
1
Returns: -1
x[i], y1[i]) and
(x[i], y2[i]). A random angle between
-Pi/2 and Pi/2, inclusive, is chosen, and a single shot is fired. The
angle -Pi/2 is straight down vertically, 0 is straight to the right
horizontally, and Pi/2 is straight up vertically. A shot is a straight
ray of infinite length starting from the point (0, 0). A shot hits a
target if there is a common point between them. Return the expected
number of targets that will be hit by the single shot. Hitting a target
doesn't change the direction of the laser shot.
Constraints
x will contain between 1 and 50 elements, inclusive.
x will be distinct.
x, y1 and y2 will contain the
same number of elements.
x will be between 1 and 1,000, inclusive.
y1 and y2 will be between
-1,000 and 1,000,
inclusive.
Examples
{1}
{-1}
{1}
Returns: 0.5
The only one target will be hit with probability 1/2.
{1,2}
{-1,-2}
{1,2}
Returns: 1.0
Both targets will be hit with probability 1/2.
{3,4,7,1}
{1,2,3,4}
{4,3,2,1}
Returns: 0.4623163952488826
{134,298,151,942}
{-753,-76,19,568}
{440,689,-39,672}