Skip to content

Instantly share code, notes, and snippets.

@CodeFlareLisa
Created July 15, 2022 13:38
Show Gist options
  • Save CodeFlareLisa/5482c42129867c2d77080d438489caf4 to your computer and use it in GitHub Desktop.
Save CodeFlareLisa/5482c42129867c2d77080d438489caf4 to your computer and use it in GitHub Desktop.
code challenge a
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");
}
}
@CodeFlareLisa
Copy link
Author

Emailed the code to another device, then uploaded it from IntelliJ from the other device. Hope it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment