Amazon Interview Question

Grouping positive numbers, zero, and negative numbers together

Interview Answer

Anonymous

May 5, 2021

public class HelloWorld{ public static void printOnConditions() { int index=0; int[] arr1={-8,3,0,-2,-10,5,0,9}; int arrLen=(arr1.length)-1; int[] arr2=new int[arr1.length]; for(int i=0;i0) { arr2[arrLen]=arr1[i]; arrLen--; } } for(int j=0;j