Consider that there are N girls standing in a line..their positions range from 1 to N... and also given is their heights...we need to select two girls such that their friendship quotient is very high...friendship quotient is defined as the product of absolute difference between the position of the two girls and the minimum height of the two girls... for ex..)consider there are 5 girls and their corresponding heights are 3 4 1 6 2...here the girls from position 1 (height 3) and positin 4 (height 6) will be selected since they have the maximum friendship quotient....since absolute diff between their position is 4 - 1 = 3 and the min height among them is ie.)min(6,3) = 3...therefore their friendship quotient = 3 * 3 = 9 which is the maximum of all...
therefore my question is given a set of numbers(height of girls) how can we find the maximum friendship quotient...i want to know whether this problem can be solved using some other efficient method than using the naive method of comparing one girl with the remaining N-1 girls and then arriving at a solution...thanks in advance....