Pergunta de entrevista da empresa Inspeero Technologies

1. To find the repeating elements in array and add them and replace it in position before the repeated element. for e.g. input array A={1,2,3,3,4,5,6,6} output array B={1,2,6,4,5,12} 2.To separate even and odd elements from an array and print new array with alternate even and odd element. 3.To print the below pattern 1 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 ..........N

Resposta da entrevista

Sigiloso

9 de set. de 2020

package ArrayManupulation; import java.util.Arrays; import java.util.Vector; public class ArrayOddEven { public static void odeven(int arr[],int n) { Arrays.sort(arr); //sorting array in ascending order. Vector v1=new Vector(); Vector v2=new Vector(); for(int i=0;i

14