-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Added C++, Java, and Python Solutions for Problem 3357 #3804
base: main
Are you sure you want to change the base?
Conversation
🤭 感谢你的提交,请检查你的改动是否符合以下项目规范。 1. 格式化我们项目中各种编程语言代码(包括文档)所采用的格式化工具不同,提交 pr 之前必须确保代码、文档正确格式化。
2. Git 提交信息我们项目遵循 AngularJS Git Commit Message Conventions 规范,我们希望你的提交信息尽可能与项目保持一致。
3. 其它补充新增题解及代码时,需要创建 Solution.xxx 源代码文件(如果已存在,请确认算法是否更优,是则覆盖已有算法代码),同时,需要在 README.md 以及 README_EN.md 中添加对应的代码片段(英文文件中不要出现中文注释) 🤭 Thank you for your contribution. Please check if your changes comply with the following project specifications. 1. FormattingWe use different formatting tools for various programming languages (including documentation) in our project. You must ensure that the code and documentation are correctly formatted before submitting a pr.
2. Git Commit MessageOur project follows the AngularJS Git Commit Message Conventions. We hope that your submission information is as consistent as possible with the project.
3. Other notesWhen adding solutions and code, you need to create a Solution.xxx source code file (if it already exists, please confirm whether the algorithm is better, if yes, overwrite the existing algorithm code), and at the same time, you need to add the corresponding code snippets in README.md and README_EN.md (do not have Chinese comments in the English file) |
Thank you for the feedback. I have formatted all the files as per the guidelines using |
Hello, the code you submitted does not match the requirements of LeetCode problem 3357. Please review and revise it. Thank you! |
@yanglbme Thank you for the feedback. I have reviewed the code and made the necessary corrections. I have updated the solution to meet the requirements of LeetCode problem 3357 and successfully pushed the changes to the repository. |
Description
This pull request adds solutions in C++, Java, and Python for LeetCode problem 3357: Minimize the Maximum Adjacent Element Difference.
Approach
The problem involves replacing missing elements (
-1
) in an array with a pair of positive integers(x, y)
such that the maximum absolute difference between adjacent elements in the resulting array is minimized.Algorithm
Binary Search + Greedy Validation:
-1
withx
andy
while keeping the array consistent can achieve the current difference.Steps:
-1
and adjacent elements.(x, y)
to satisfy the current difference.Complexity:
nums[i]
(given as (10^9)).Languages Implemented
Testing
-1
elements.-1
elements.-1
and large values.Additional Notes