104. Maximum Depth of Binary Tree

104. Maximum Depth of Binary Tree

[Easy] “Given a binary tree, find its maximum depth."

Link to Leetcode

Note: old solution, should review (TODO:)

Python3:

class Solution:
    def majorityElement(self, nums: List[int]) -> int:
        uniq_nums = list(set(nums))
        max_count_and_num = [0,0]
        target = len(nums) / 2
        for n in uniq_nums:
            if nums.count(n) > target:
                return n
            if nums.count(n) > max_count_and_num[0]:
                max_count_and_num[0] = nums.count(n)
                max_count_and_num[1] = n
        
        return max_count_and_num[1]