You are viewing a single comment's thread. Return to all comments →
for(int z=1;z<=t;z++) { sum = s.nextInt(); n = s.nextInt(); int a[] = new int[n]; for(int i=0;i<n;i++) { a[i] = s.nextInt(); } for(int i=0;i<n-1;i++) { for(int j=i;j<n-1;j++) { if(a[i]+a[j+1]==sum) { System.out.println((i+1)+" "+(j+2)); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →