Skip to content

feat: add solutions for lc No.3890#5135

Merged
yanglbme merged 1 commit intomainfrom
dev
Apr 5, 2026
Merged

feat: add solutions for lc No.3890#5135
yanglbme merged 1 commit intomainfrom
dev

Conversation

@yanglbme
Copy link
Copy Markdown
Member

@yanglbme yanglbme commented Apr 5, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 5, 2026 09:55
@idoocs idoocs added core team Issues or pull requests from core team cpp Issues or Pull requests relate to .cpp code go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code ts Issues or Pull requests relate to .ts code labels Apr 5, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds multi-language reference solutions and documentation for LeetCode 3890: Integers With Multiple Sum of Two Cubes.

Changes:

  • Implemented preprocessing (enumerate (1 \le a \le b \le 1000)) + binary search query across C++, Java, Go, Python, and TypeScript.
  • Added/expanded CN + EN explanations and code snippets in the problem README files.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/Solution.ts TypeScript solution using precomputed “good” integers and binary search.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/Solution.py Python solution with module-level preprocessing and bisect query.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/Solution.java Java solution using static init preprocessing and binary search.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/Solution.go Go solution using init() preprocessing and sort.Search.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/Solution.cpp C++ solution using global init lambda preprocessing and upper_bound.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/README.md CN editorial: preprocessing + binary search, with multi-language snippets.
solution/3800-3899/3890.Integers With Multiple Sum of Two Cubes/README_EN.md EN editorial: preprocessing + binary search, with multi-language snippets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})();

function findGoodIntegers(n: number): number[] {
const idx = _.sortedLastIndex(GOOD, n);
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other TypeScript solutions in this repo (which generally use _.sortedIndex(arr, x + 1) for an upper bound), consider replacing _.sortedLastIndex(GOOD, n) with _.sortedIndex(GOOD, n + 1) in the TypeScript snippet.

Suggested change
const idx = _.sortedLastIndex(GOOD, n);
const idx = _.sortedIndex(GOOD, n + 1);

Copilot uses AI. Check for mistakes.
})();

function findGoodIntegers(n: number): number[] {
const idx = _.sortedLastIndex(GOOD, n);
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other TypeScript solutions in this repo (which generally use _.sortedIndex(arr, x + 1) for an upper bound), consider replacing _.sortedLastIndex(GOOD, n) with _.sortedIndex(GOOD, n + 1) in the TypeScript snippet.

Suggested change
const idx = _.sortedLastIndex(GOOD, n);
const idx = _.sortedIndex(GOOD, n + 1);

Copilot uses AI. Check for mistakes.
})();

function findGoodIntegers(n: number): number[] {
const idx = _.sortedLastIndex(GOOD, n);
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most TypeScript solutions in this repo use _.sortedIndex(arr, x + 1) to implement an upper-bound (e.g., solution/3700-3799/3770.../Solution.ts). Consider switching from _.sortedLastIndex(GOOD, n) to _.sortedIndex(GOOD, n + 1) for consistency with the existing pattern.

Suggested change
const idx = _.sortedLastIndex(GOOD, n);
const idx = _.sortedIndex(GOOD, n + 1);

Copilot uses AI. Check for mistakes.
@yanglbme yanglbme merged commit 47a4bd8 into main Apr 5, 2026
18 checks passed
@yanglbme yanglbme deleted the dev branch April 5, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core team Issues or pull requests from core team cpp Issues or Pull requests relate to .cpp code go Issues or Pull requests relate to .go code java Issues or Pull requests relate to .java code md Issues or Pull requests relate to .md files py Issues or Pull requests relate to .py code ts Issues or Pull requests relate to .ts code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants