Solución

@frank941612_99ee8978·12/9/2026TypeScript
solution.tsTypeScript
public class Solution {
    	public int[] goldbachPair(int n) {
		int[] cousinNumbers = new int[]{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
		for(int i = 0; i <cousinNumbers.length ;i++) {
			 int firstElement = cousinNumbers[i];
			 for(int j  = 0; j < cousinNumbers.length; j++) {
				 int subsecuent = cousinNumbers[j];
				 if((firstElement + subsecuent) == n) {
					 return new int[]{firstElement, subsecuent};
				 }
			 }
		}
		return null;
	}
}
0respuestas
Respuestas

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.