Question: Write an answer in Golang There is an array A made of N integers. Your task is to choose as many integers from A as
Write an answer in Golang
There is an array A made of N integers. Your task is to choose as many integers from A as possible so that, when they are put in ascending order, all of the differences between all pairs of consecutive integers are equal. For example, for A you could choose and with differences equal to or and with differences equal to So answer in this case will be
What is the maximum number of integers that can be chosen? Write a function.
Example :
A function should return integers when put in ascending order the difference between all consecutive integers is
Example :
A function should return It is optimal to chose all integers with value
Example :
A function should return integers when put in ascending order the difference between all consecutive integers is Notice that we cannot pick any other integers, even though they occur more than once.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
