contributed by < AxotZero
>
COND1 = head->next && head->val == head->next->val
COND2 = head->next && head->val == head->next->val
Haven't figured out whether there is another way to complete these two conditions.
Inspired from 案例探討: Leetcode 2095. Delete the Middle Node of a Linked List, I tried to use ptr2ptr to solve this problem and reduce branch of this program.
Still figuring out the better way to simplify the code
list_for_each_entry_safe
lRUCacheFree
, It needs to delete all the container of each list_head
. Hence, we need a safe
pointer which represent the next node of current node that will be delete.list_for_each_entry
safe
pointer.list_last_entry
get
and put
value from cache, the program will move the target node to the first. Hence, the last element will be the least recently used element.TODO
--left
and RRR = ++right
++left
and RRR = --right
pre-decrement
/ pre-increment
operation to make program correct.TODO