https://www.codewars.com/kata/5547cc7dcad755e480000004/train/javajava
import java.util.*; public class RemovedNumbers{ public static List<long[]> removNb(long n){ List<long[]> arr = new ArrayList<long[]>(); long sum = (1+n) * n /2; for(long i=n/2+1; i<=n; i++){ for(long j=n/2+2; j<=n; j++){ long product = i * j; long left = sum - i - j; if(i != j){ if(product == left){ arr.add(new long[]{i,j}); arr.add(new long[]{j,i}); //return arr; } if(product > left){ break; } } } } return arr; } }
Process was terminated. It took longer than 12000ms to completecode