Given an array A of integers and integer K, return the maximum S such that there exist i < j with A[i] + A[j] = S and S < K. If no i, j exist satisfying this equation, return -1
Category Archives: php
Sum of even Fibonacci numbers less than x
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
Using PHP code to solve problems multiples of 3 and 5
If we list all the natural numbers from 0 – 40 that are multiples of 3 and 5, we get 15 and 30 only.
The sum of these multiples is 45.
Using PHP code to solve problems multiples of 3 or 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.