-
Notifications
You must be signed in to change notification settings - Fork 3
update: 添加问题“1458.两个子序列的最大点积”的代码和题解 #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1458: AC.cpp (#1310) + word(en) + fix(pic) cpp - AC,84.23%,29.53% py - AC,97.99%,39.85% go - AC,76.92%,38.46% java - AC,65.24%,32.38% rust - AC,100.00%,60.00% Signed-off-by: LetMeFly666 <814114971@qq.com>
LetMeFly666
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
昨晚忘记测试api-hook-listener了
|
waiting for copilot and test for hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a solution for LeetCode problem 1458 "两个子序列的最大点积" (Max Dot Product of Two Subsequences) in five programming languages (C++, Python, Java, Go, and Rust). The solution uses dynamic programming to find the maximum dot product between two subsequences.
Key changes:
- Implemented the max dot product solution in C++, Python, Java, Go, and Rust
- Updated README.md with the new problem entry and links to solutions
- Added three new English vocabulary words to the learning notes
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| toSay.md | Removed outdated announcement about Cloudflare proxy changes |
| Solutions/Other-English-LearningNotes-SomeWords.md | Added three new English vocabulary words (defy, pasture, tread) |
| README.md | Added entry for problem 1458 with links to solutions on multiple platforms |
| Codes/lib.rs | Updated include statement to reference the new Rust solution file |
| Codes/1458-max-dot-product-of-two-subsequences.rs | New Rust implementation using DP with O(n*m) time complexity |
| Codes/1458-max-dot-product-of-two-subsequences.py | New Python implementation using DP with enumerate |
| Codes/1458-max-dot-product-of-two-subsequences.java | New Java implementation using DP with Arrays.fill for initialization |
| Codes/1458-max-dot-product-of-two-subsequences.go | New Go implementation with custom max helper functions |
| Codes/1458-max-dot-product-of-two-subsequences.cpp | New C++ implementation using space-optimized DP approach |
| .commitmsg | Commit message with performance metrics for all language implementations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| for (int i = 1; i <= n; i++) { | ||
| for (int j = 1; j <= m; j++) { | ||
| dp[i][j] = Math.max(nums1[i-1] * nums2[j-1], Math.max(dp[i-1][j], Math.max(dp[i][j - 1], dp[i-1][j-1] + nums1[i-1] * nums2[j-1]))); |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing around the subtraction operator. The expression uses dp[i][j - 1] with spaces but nums1[i-1] and nums2[j-1] without spaces. For better consistency and readability, consider using uniform spacing: either spaces around all minus operators or no spaces for all.
| dp[i][j] = Math.max(nums1[i-1] * nums2[j-1], Math.max(dp[i-1][j], Math.max(dp[i][j - 1], dp[i-1][j-1] + nums1[i-1] * nums2[j-1]))); | |
| dp[i][j] = Math.max(nums1[i - 1] * nums2[j - 1], Math.max(dp[i - 1][j], Math.max(dp[i][j - 1], dp[i - 1][j - 1] + nums1[i - 1] * nums2[j - 1]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦吼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不如把dp[i][j - 1]换成·、dp[i][j-1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing around the subtraction operator. The expression uses dp[i][j - 1] with spaces but nums1[i-1] and nums2[j-1] without spaces. For better consistency and readability, consider using uniform spacing: either spaces around all minus operators or no spaces for all.减法算符周围的间距不一致。表达式使用 dp[i][j - 1],带有空格,但 nums1[i-1] 和 nums2[j-1],不含空格。为了提高一致性和可读性,建议使用均匀间距:要么在所有负算符周围空格,要么全都不加空格。
@copilot 把这次java的dp[i][j - 1]换成dp[i][j-1],pr中不要包含有多余文件
|
@LetMeFly666 I've opened a new pull request, #1312, to work on those changes. Once the pull request is ready, I'll request review from you. |
bye! 先合了哈哈 下次merge到新火车上 |
…rd(en) + fix(pic) 420c93d
By newSolution.py using GH on MacOS | close: #1310