For this Question: Given a Doubly linked list consisting of <b>N</b> nodes and given a number <b>K</b>. The task is to delete the Kth node from the end of the linked list.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>deleteElement()</b> that takes head node and the position K as parameter.

Constraints:
1 <=K<=N<= 1000
1 <=value<= 1000Return the head of the modified Doubly linked listInput:
5 3
1 2 3 4 5

Output:
1 2 4 5

Explanation:
After deleting 3rd node from the end of the linked list, 3 will be deleted and the list will become 1, 2, 4, 5., I have written this Solution Code:   public static Node deleteElement(Node head,int k) {
int cnt=0;
Node temp=head;
while(temp!=null){
cnt++;
temp=temp.next;
}
k=cnt-k;

if(k==0){head=head.next; 
head.prev=null;
return head;}
temp=head;
int i=0;
while(i!=k-1){
temp=temp.next;
i++;
    }
temp.next=temp.next.next;
if(k!=cnt-1){temp.next.prev=temp;}

        return head;
    }, In this Programming Language: Java, Now tell me if this Code is compilable or not?