Function to find the length of the longest subsequence such that no two adjacent elements are equal
static void longestSubsequence ( int N , int Q , int arr [ ] , int Queries [ ] [ ] ) { for ( int i = 0 ; i < Q ; i ++ ) {