Created
August 11, 2015 21:12
-
-
Save code4sharing/3716612992a1ddfe4cae to your computer and use it in GitHub Desktop.
hackerrank solutions in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Print elements of a linked list on console | |
head pointer input could be NULL as well for empty list | |
Node is defined as | |
class Node { | |
int data; | |
Node next; | |
} | |
*/ | |
// This is a "method-only" submission. | |
// You only need to complete this method. | |
void Print(Node head) { | |
if(head!=null) | |
{ | |
System.out.printf("%d\n",head.data); | |
Print(head.next); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment