Ayush-Tibrewal / LEETCODE---Java-Solutions-

0 stars 0 forks source link

Linked List #4

Open Ayush-Tibrewal opened 4 months ago

Ayush-Tibrewal commented 4 months ago

head.next = temp // idhar head refrence ya pointer rakh dega temp k next par

head = temp.next // idhar temp k next ki jo bhi value hogi wo head mein store ho gi

Ayush-Tibrewal commented 4 months ago

counting in the linked list int count =1; while(temp.next!=null){ temp = temp.next; count++; }

Ayush-Tibrewal commented 4 months ago

ListNode temp = head; ListNode prev = null ; ListNode next =null; while(temp!=null && c>0){ next = temp.next; temp.next = prev ; prev = temp ; temp = next ;