Hacker Rank Problem-Print in Reverse a linked list in c++



A recursive method to print in reverse working well go ahead and try this method -


void reversePrint(SinglyLinkedListNode* head) {
     if(head == NULL)return ;
    
     reversePrint(head->next);
     cout<<head->data<<endl;
 
}


20 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.