


'N' = 7, 'C' = 4, pages = [1, 2, 1, 4, 2, 3, 5].
For the first four pages, memory allocated with four pages, {1, 2, 1, 4}, page fault = 3.
For fifth, page number 2 is required, which is already present, page fault = 3.
Then, page number 3 is required, replaces LRU 2, page fault = 4.
Then, page number 5 is required, replaces LRU 1, page fault = 5.
The total page fault is 5.
The first line contains two space-separated integers, ‘N’ and ‘C’.
The next line contains the array ‘Pages’ of the length ‘N’, denoting the page sequences.
The only line contains a single integer denoting the total number of page faults.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
Algorithm:
Algorithm: