Hacker Rank Problem -Delete a Node in c++

SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* head, int position) { SinglyLinkedListNode * temp = head; SinglyLinkedListNode * go = head->next;; if(position == 0) { head=head->next; free(temp); return head; } for(int i = 0;i<position;i++) { } for(int i = 1;i<position;i++) { temp=temp->next; go=go->next; } if(go->next==NULL){ temp->next = NULL; free(go); } temp->next = go->next; free(go); return head; }

5 views0 comments

Recent Posts

See All

How to create a Web View In swift Ios

import UIKit // import webkit framework import WebKit class ViewController: UIViewController, WKNavigationDelegate { // view controller inherit from WkNavigation Delegate // create a object of Wk

How to work with an api in Swift

Create a URl let url = URL(string: " your_url")! Create a URL Session let datatask = URLSession.shared.dataTask(with: url) { (data, response, error) in if let data = data { print(data) }else { p

 

Follow

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter

Contact

Address

VILLAGE-HiRAPUR KALAN
POST-KARANWAS DIBAI

©2020 by ThE RoYaL LaKsHyA.