Question Design a student grade management system consisting of two classes: Student and Result. Student Class Implement a Student class...
Input: String Output: Printed output
codingMediumtree#1
1. Binary Tree Depth Calculation — Calculate the maximum depth of a binary tree
Background: PayPal employs complex data structures to manage transaction workflows and user account hierarchies. Understanding the depth of binary trees can help optimize search operations in these systems. Problem statement: Given a binary tree, determine its maximum depth. The function should return the number of nodes along the longest path from the root node down to the farthest leaf node. A leaf is a node with no children. Function/class signature:
def max_depth(root: Optional[TreeNode]) -> int:
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 3
Explanation: The maximum depth is 3 because the longest path is 3 -> 20 -> 15.
Example 2:
Input: root = [1,null,2]
Output: 2
Explanation: The maximum depth is 2 because the longest path is 1 -> 2.
Constraints:
Node count in the tree can range from 0 to 1000.
Each node's value is at most 1000.
root can be None for an empty tree.
codingMediumgraph#2
2. Graph — Find the Shortest Payment Path
Background: In financial transactions, finding the shortest path for payments between two linked financial institutions can optimize transaction processing. This relates to PayPal’s payment system, aiming to minimize transaction fees and times.Problem statement: Given a directed acyclic graph where nodes represent financial institutions and edges represent transaction fees between them, write a function to find the minimum transaction fee necessary to transfer money from a starting institution to a target institution. The output should indicate both the minimum fee and the path taken.Function/class signature: