Question: Without using library, How should I change the following code? Thanks void longestSubSeq_NoDup(const int* a, int n, int& start, int& len) { // Array a[]
Without using
void longestSubSeq_NoDup(const int* a, int n, int& start, int& len) {
// Array a[] is interpreted as a circular array.
// start = start index of the longest subsequence without duplicated value
// len = length of the longest subsequence without duplicated value // for this everything is same as part-1 but the difference is that here //we need to take a set so that we can check for duplicates. //and inner loop will run until it does not find duplicates. int longest_seq_size = 0; int index = 0; int i=0; for(int i=0;i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
