Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Problem Link: https://www.codingninjas.com/studio/problems/clone-a-linked-list-with-random-pointers_983604?leftPanelTab=1
- Author: Sarthak Joleya
- public class Solution {
- public static Node cloneLL(Node head) {
- Node ans = new Node(-1) , tmp = head;
- Node prev = ans;
- while(tmp != null){
- Node x = new Node(tmp.data);
- prev.next = x;
- prev = x;
- tmp = tmp.next;
- }
- prev = ans.next;
- tmp = head;
- while(tmp != null){
- prev.random = tmp.random;
- prev = prev.next;
- tmp = tmp.next;
- }
- return ans.next;
- }
- }
- #User Accounts
- https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
- https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
- https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
- https://i.ibb.co/xYNVfLP/IMG-20230827-151348.jpg
- https://www.ebay.com/usr/oma2748
- https://www.ebay.com/usr/ast-4867
- https://www.ebay.com/usr/daric-4116
- https://www.ebay.com/usr/mada_617503
- #Listings
- https://tinyurl.com/RTX4080-Scam-1
- https://tinyurl.com/RTX4080-Scam-2
- https://tinyurl.com/RTX4080-Scam-3
- https://tinyurl.com/RTX4080-Scam-4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement