Advertisement
joeljf

PRIVE

Jun 24th, 2019 (edited)
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. Problem Link: https://www.codingninjas.com/studio/problems/clone-a-linked-list-with-random-pointers_983604?leftPanelTab=1
  2. Author: Sarthak Joleya
  3.  
  4. public class Solution {
  5. public static Node cloneLL(Node head) {
  6. Node ans = new Node(-1) , tmp = head;
  7. Node prev = ans;
  8. while(tmp != null){
  9. Node x = new Node(tmp.data);
  10. prev.next = x;
  11. prev = x;
  12. tmp = tmp.next;
  13. }
  14. prev = ans.next;
  15. tmp = head;
  16. while(tmp != null){
  17. prev.random = tmp.random;
  18. prev = prev.next;
  19. tmp = tmp.next;
  20. }
  21. return ans.next;
  22. }
  23. }
  24.  
  25. #User Accounts
  26. https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
  27. https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
  28. https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
  29. https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
  30. https://www.ebay.com/usr/oma2748
  31. https://www.ebay.com/usr/ast-4867
  32. https://www.ebay.com/usr/daric-4116
  33. https://www.ebay.com/usr/mada_617503
  34.  
  35. #Listings
  36. https://tinyurl.com/RTX4080-Scam-1
  37. https://tinyurl.com/RTX4080-Scam-2
  38. https://tinyurl.com/RTX4080-Scam-3
  39. https://tinyurl.com/RTX4080-Scam-4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement