Sakshi Singh
1 min readDec 28, 2018

HACKERRANK SOLUTION: Delete a Node

//COPY PASTE THIS PART OF CODE IN THE GIVEN BLANK SPACE OF YOUR EDITOR….

static SinglyLinkedListNode deleteNode(SinglyLinkedListNode head, int position) {

if(position == 0)

{

head = head.next;

return head;

}

else{

SinglyLinkedListNode n1 = head;

for(int i=0;i<position-1;i++)

{

n1 = n1.next;

}

n1.next=n1.next.next;

return head;

}

}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sakshi Singh
Sakshi Singh

No responses yet

Write a response