Codesignal Practice Question

Anonymous User
214
Sep 23, 2022

Given an array of distinct integers numbers, your task is to find the number of pairs of indices (i, j) such that i ≤ j and the sum numbers[i] + numbers[j] is a full square.

Return the number of pairs you found.

Example:
[0, -1, 3, 1]
(0, 0), (-1, 1), (3, 1)

Therefore, Answer is 3.

I know it might not hard, but looking for optimal solution

Thanks

Comments (0)