algorithm - Find the maximum value in an array that's the sum of 3 other values -
Looking at a very large integer array, I need to find the maximum value of Where there are all values in the A array. How will I do this? Note: Using 4 for loops is not the ideal solution. There is a simple (expected) O (N ^ 2) solution: If you want to avoid using more than one element, then you need some additional information in the hash table so that you can filter the pairs that are either a1 or a4 fast Let's slide with. If the integers are bound in the array (max - min a4 , such as:
a4 = a1 + a2 + a3
Comments
Post a Comment