Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- static boolean subset(int[] a, int[] b) {
- for (int i = 0; i < a.length; i++) {
- boolean found = false;
- for (int j = 0; j < b.length; j++) {
- if (a[i] == b[j]) {
- found = true;
- break;
- }
- }
- if (found == false) return false;
- }
- return true;
- }
- public static void main(String[] args) {
- int[] a = {1, 2, 3};
- int[] b = {2, 4, 5, 1, 3};
- System.out.println(subset(a, b));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment