Find the maximum product of three numbers in an array?
Eg. 9,5,1,2,3
Max product= 9*5*3= 135
The array can hav negative numbers also..

Answer Posted / bharghavi

consider the array: 10,2,-7,-5,3
Descending order: 10,3,2,-5,-7
Then ur result will give: 10*3*2=60
But the max. product can be: 10*(-5)*(-7) =350

Is This Answer Correct ?    4 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

1+1/2!+1/3!+...+1/n!

1945


How can I Draw an ellipse in 3d space and color it by using graph3d?

2138


Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)

4453


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3195


write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20

3368






write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

2370


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

3274


write a program using virtual function to find the transposing of a square matrix?

2845


U hv to enter a range from a and b and search hw many no. of times a pattern n. occurs between the range a and b. Eg :i/p:enter range :0 100 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 0 to 100:1 Eg :i/p:enter range :100 1000 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 100 to 1000: (in this 13,113,131,132,133…139,213,313,…913 all these will be counted)

2127


Code for Method of Handling Factorials of Any Size?

2008


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2407


write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

3270


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

2937


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2565


How to Split Strings with Regex in Managed C++ Applications?

3132