Longest subsequence approach -1

the first approach which has been taught using hashmap i am facing problem while implementing the code. how to traverse over the map to check whether that element is present in array
here is my code

the first approach which has been taught using hashmap i am facing problem while implementing the code. how to traverse over the map to check whether that element is present in array here is my code https://ide.codingblocks.com/s/301372

@aditikandhway hey for that just store that element as index of map and set value as 1 if it is present or 0 if it is not present so now to check whether that element is present orr not just acess value of map[element] if it is 1 then it is present otherwise its not.

okay but how we can access the longest adjacent subsequence??

@aditikandhway hey for that you have to use DP.Check the dp logic you will get it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.