Can you help me correct my code

Problem link : https://leetcode.com/problems/lru-cache/
https://ide.codingblocks.com/s/280324

I’m geting errror in the get method

hi @amitqy you need to check if newnode->next is NULL or not before accessing newnode->next->prev

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.

hi @Ishitagambhir can pls take a look at my doubt
here : 'Course Schedule' Problem .Can you help me optimize my code

@amitqy @chhavibansal has already responded to your doubt there. You have to apply topological sort here.

The approach I am using is very similar to topological sort, we do a topo sort only if the graph does not have any cycle. So I am checking if the graph has cycle or not. Most voted answer there is also using cycle detection

@amitqy have some patience you have raised a doubt you will get a response soon