QUESTION
The version of Python being used is 2.7.
A company has a number of products in
stock. They have multiple products
available for a single product ID. The
product IDs of the products are denoted
by 1 to N. The company wants to
analyze the difference between the
maximum number of products available
and the minimum number of products
available for any two different product
IDs so that they can increase the supply
of the products which are low in stock. In
addition, the product with a higher
number of products in stock should also
have a greater product ID than the
product ID which has fewer items in
stock.
Write an algorithm to find the maximum
difference between the minimum and the
maximum number of products available
for a given list of product IDs
Input
The first line of the input consists of an
integer - num, representing the number
Attachments:
Answers
Answered by
22
Answer:
To get an basic idea to know functions in python:
def findMinimum(arr, n, k)
res = 0
i = 0
while(n):
res += arr[i
n = n-k
i += 1
return res
Explanation:
Answered by
5
Answer:
To get an basic idea to know functions in python:
def findMinimum(arr, n, k)
res = 0
i = 0
while(n):
res += arr[i
n = n-k
i += 1
return res
Explanation:
Similar questions