Amazon interview question

Maximum Contiguous Subarray Problem(kadane's algorithm ) Find all the leaves of BST .