Longest Subsequence such that difference between adjacent elements is either A or B
Given an array arr of size N, and two integers A and B. The task is to find the length of the longest subsequence with the difference between adjacent elements as either A or B. Example: Input : arr[]={ 5, 5, 5, 10, 8, 6, 12, 13 }, A=0, B=1Output : 4Explanation : Maximum length subsequence is {5,5,5