+ 1
Java code (Find same int from arrays)
There got one more same int from both array which is 2 , why 2 didn't print out? https://code.sololearn.com/c6P5wOuS39kR
3 Réponses
+ 2
It's because you start at the i index of the array, so when it gets to the number 2 in the array (which has the index 2), x starts from 2, but in the second array, it's index is 0, so it can't be found. In the second loop you have to start x from 0
+ 1
// for(int x = i;x < arr2.length;x++){
for(int x = 0;x < arr2.length;x++){ // x=0