Problem Leetcode 938: Range sum BST Level: Easy Link Range Sum of BST - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com My Approach # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self...
Problem Leetcode 107: Binary Tree Level order Traversal II Level: Medium Link Binary Tree Level Order Traversal II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com My Approach BFS Traversal with each tree level tracked # Definition for a binary tree node. # class TreeNode: # def _..
Leetcode: 1161 - Maximum level of sum of a binary tree Level: Medium Link Maximum Level Sum of a Binary Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com My approach Iterate through the tree with a bfs approach For each level, sum up the value of each leaf update to a dictiona..