Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.
Given an array arr
, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Example:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Given a n-arry tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.