For a given array 'a' of size n, create sets of elements by repeatedly following indices: a[i], a[a[i]], a[a[a[i]]], etc., for each starting index i from 0 to n-1. Find the maximum size among all such…
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.