Created
July 15, 2022 13:38
-
-
Save CodeFlareLisa/5482c42129867c2d77080d438489caf4 to your computer and use it in GitHub Desktop.
code challenge a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Code_Challenge_Solution { | |
public static void main(String[] args) { | |
int[] listFirst = {1, 2, 3, 5, 7, 9, 11, 12, 13}; | |
int[] listSecond = {2, 4, 5, 6, 8, 10, 12}; | |
int i = 0; // listFirst.length; | |
int j = 0; // listSecond.length; | |
while (i < listFirst.length && j < listSecond.length) { | |
if (listFirst[i] == listSecond[j]) { | |
System.out.println("The List Intersect: " + listFirst[i]); | |
return; | |
} else if (listFirst[i] < listSecond[j]) { | |
i++; | |
} else { | |
j++; | |
} | |
} | |
System.out.println("testing"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Emailed the code to another device, then uploaded it from IntelliJ from the other device. Hope it worked!