Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mapple company has just released a latest model of MPhoneXl.There is a queue outside one of the stores and the store manager has decided for

Mapple company has just released a latest model of MPhoneXl.There is a queue outside one of the stores and the store manager has decided for 2 giveaways to attract more customers. The giveaways will be given to the people who are in the queue.The store manager has asked the customers in the queue to pick a positive number of their choice. Manager finds the floor average of the numbers picked by them and prepares a shortlist of those who have chosen floor average as their number. He then identifies the maximum distance between the shortlisted. The maximum distance is the output.Given an array of N positive integers, representing the numbers chosen by N customers in the queue. Write a program to find out the maximum distance between the winners. Print -1 if at least two winners cannot be identified.Input Format: Input string will contain all the positive integers separated by comma.Output Format: Only one positive integer has to be printed or -1 in case at least two winners cannot be identifiedSample input: 7,5,3,2,5,3,2,3Sample Output: 5Explanation: 3 is the floor average.We have 3 inputs matching number 3 and the maximum distance between 2 such inputs is 5.Sample input: 6,7,8,9,3,2,3Sample output: -1Explanation: 5 is the floor average.Since no winner can be identified, -1 should be printed as the output.Use Python 3.0 version to code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago