(Coursera) Data Structures and Algorithms Specialization/Nagendra/Algorithmic Toolbox/week5_dynamic_programming1/4_longest_common_subsequence_of_two_sequences/LCS2.java
<filename>(Coursera) Data Structures and Algorithms Specialization/Nagendra/Algorithmic Toolbox/week5_dynamic_programming1/4_longest_common_subsequence_of_two_sequences/LCS2.javaimport java.util.*;

public class LCS2 {

    private static int lcs2(int[] a, int[] b) {
        //Write your code here
        return Math.min(a.length, b.length);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = scanner.nextInt();
        int[] b = new int[m];
        for (int i = 0; i < m; i++) {
            b[i] = scanner.nextInt();
        }

        System.out.println(lcs2(a, b));
    }
}

