What do you want to save?
Add Code snippet
New code examples
-
Other 2021-09-13 12:42:03
mirror a binary tree
//mirror a binary tree void mirror(Node root){ Queue<Node> q=new LinkedList<>(); q.add(root); while(!q.isEmpty()){ Node currnode=q.poll(); Node temp=currnode.left; currnode.left=currnode.right; currnode.right=temp; if(currnode.left!=null){ q... Add solution -
Javascript 2021-09-06 09:53:02
react.createElement
//Below I use the React.createElement() function to create a virtual DOM //representation of a <li> element node containing a text node of one (a.k.a., //React text) and an id of li1. var reactNodeLi = React.createElement('li', {id:'li1'}, 'one'); Add solution -
Java 2021-09-01 14:19:02
reverse linked list in java to get both head and tail
/* public class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; next = null; } } */ public static ListNode[] reverse_linked_list(ListNode head) { ListNode prev = null; ListNode current = hea... Add solution