Skip to main content

Posts

Showing posts with the label Day 15: Linked List Hackerrank Solution Java

Day 15: Linked List Hackerrank Solution Java

 Day 15: Linked List Hackerrank Solution Java For Explanation Check Video: Sample Input STDIN Function ----- -------- 4 T = 4 2 first data = 2 3 4 1 fourth data = 1 Sample Output 2 3 4 1 Code: import  java.io.*; import  java.util.*; class  Node {      int  data;     Node next;     Node( int  d) {         data = d;         next = null;     } } class  Solution {      public   static   Node insert(Node head, int  data) {         Node n =  new  Node(data);          if (head==null){              return  n;   ...