Skip to content

Instantly share code, notes, and snippets.

@code4sharing
Created August 11, 2015 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code4sharing/3716612992a1ddfe4cae to your computer and use it in GitHub Desktop.
Save code4sharing/3716612992a1ddfe4cae to your computer and use it in GitHub Desktop.
hackerrank solutions in java
/*
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