Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds solutions to LeetCode problem 3562 "Maximum Profit from Trading Stocks with Discounts" from Weekly Contest 451. The problem involves maximizing stock trading profits in a company hierarchy where employees can get discounts if their direct boss purchases stock.
Key changes:
- Implements tree-based dynamic programming solutions across five programming languages
- Adds comprehensive problem documentation in both Chinese and English
- Includes visual examples and constraints for the problem
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
Solution.py |
Python implementation using DFS with 2D DP state tracking budget and parent purchase status |
Solution.java |
Java implementation with class-level state management for graph and arrays |
Solution.cpp |
C++ implementation using lambda with recursive capture for DFS |
Solution.go |
Go implementation with closures for DFS traversal |
Solution.ts |
TypeScript implementation with proper Math.floor for integer division |
README.md |
Chinese problem description with examples, constraints, and inline solution code |
README_EN.md |
English problem description with examples, constraints, and inline solution code |
CONTEST_README.md |
Updated contest index to include reference to problem 3562 |
CONTEST_README_EN.md |
Updated English contest index to include reference to problem 3562 |
README.md (solution/) |
Updated main problem index with problem 3562 metadata |
README_EN.md (solution/) |
Updated English main problem index with problem 3562 metadata |
The solutions correctly implement a tree DP algorithm where each node maintains state for different budget levels and parent purchase decisions. All language implementations are consistent and handle the discount policy correctly (half price when parent buys). No issues were identified in the code logic, naming conventions, or documentation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.