Refer https : www . geeksforgeeks . org / longest - repeating - subsequence / for complete code . This function mainly returns LCS ( str , str ) with a condition that same characters at same index are not considered .
function findLongestRepeatingSubSeq ( str ) { let n = str . length ;