private TreeNode core(TreeNode root){ if(root==null){ return null; } if(root.left!=null){ TreeNode L = core(root.left); TreeNode R = core(root.right); root.left = null; root.right = L; TreeNode tail = L; while(tail.right!=null){ tail = tail.right; } tail.right = R; ...
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its level order traversal as: [ [3], [9,20], [15,7] ] 1. 2....
https://leetcode.com/problems/linked-list-cycle/ Top view of a binary Tree psuedo code for Topological sort Again two interviewers started from intro and explain one of your most challenging project.some project related questions after that he asked me a coding question on DP which was very t...
https://leetcode.cn/problems/number-of-ways-to-reconstruct-a-tree 这道题曾经在周赛难度分top1呆了几年,如今已经不在难度分top5了。破局的关键是父节点的邻居数肯定不少于子节点,而根节点的邻居数一定是n-1。所以应该先找到根节点,然后逐层向下建树,子节点的邻居一定是父节点的子集,否则就是非法;如果子...
0144.binary-tree-preorder-traversal 0150.evaluate-reverse-polish-notation 0152.maximum-product-subarray 0199.binary-tree-right-side-view 0200.number-of-islands 🆕 0201.bitwise-and-of-numbers-range 0208.implement-trie-prefix-tree 0209.minimum-size-subarray-sum 0215.kth-largest-element-in-an-array...
For a given Binary Search Tree with unique values and two node values, write a code to find the Lowest Common Ancestor of the two given nodes in the Binary Search Tree. For a given Binary Tree, write a function to print the bottom view of the tree from left to right. ...
Interview 6.2k Interview = 简历指南 + LeetCode + Kaggle tensorlayer 6.2k Deep Learning and Reinforcement Learning Library for Scientists and Engineers 🔥 generative-models 6.1k Collection of generative models, e.g. GAN, VAE in Pytorch and Tensorflow. machine-learning-yearning-cn 6.1k Machine Lear...
Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path does not need to go through the root. ...
Check the consistency of the numbers (Trie Data Structure Question) Constructing the Array Range Minimum Query PPATH - Prime Path Problem Leetcode Problem Solution Count Number of Nodes in a Complete Binary Tree (Leetcode Problem Solution)
One more question to test the problem-solving skill of the candidate. You wouldn't expect these kinds of questions in the telephonic round of Java interviews but these questions have now become norms. All interviewer is looking it for logic, you don't need to write the code but you should...