Encuentra los números positivos sin repetir de un arreglo
Escribe una función que reciba un arreglo y devuelva un nuevo arreglo con los números positivos sin repetir (mayores que 0).
Ejemplos
Program.uniquePositive(new int[] {-5, 1, -7, -5, -2, 3, 3, -5, -1, -1}) ➞ new int[] {1, 3}
Program.uniquePositive(new int[] {3, -3, -3, 5, 5, -6, -2, -4, -1, 3}) ➞ new int[] {3, 5}
Program.uniquePositive(new int[] {10, 6, -12, 13, 5, 5, 13, 6, 5}) ➞ new int[] {10, 6, 13, 5}Notas
- Devuelve los elementos en el orden en que aparecen en el arreglo.
- La función también debe funcionar con arreglos vacíos.