Java
Java copied to clipboard
Adds Longest Arithmetic Subsequence Implementation
Description This PR implements the Longest Arithmetic Subsequence algorithm. The algorithm identifies the length of the longest arithmetic subsequence from a given array of integers, where a subsequence is defined as arithmetic if the differences between consecutive elements are the same.
Key Changes: Added LongestArithmeticSubsequence.java under the dynamicprogramming directory. The implementation uses dynamic programming with a HashMap to store the differences between elements and keep track of subsequences efficiently.
- [x] I have read CONTRIBUTING.md.
- [x] This pull request is all my own work -- I have not plagiarized it.
- [x] All filenames are in PascalCase.
- [x] All functions and variable names follow Java naming conventions.
- [x] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
- [x] All new code is formatted with
clang-format -i --style=file path/to/your/file.java
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 52.98%. Comparing base (
48a2980) to head (cc9421f).
Additional details and impacted files
@@ Coverage Diff @@
## master #5501 +/- ##
============================================
+ Coverage 52.93% 52.98% +0.05%
- Complexity 3306 3311 +5
============================================
Files 528 529 +1
Lines 15330 15343 +13
Branches 2922 2925 +3
============================================
+ Hits 8115 8130 +15
+ Misses 6881 6880 -1
+ Partials 334 333 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Please remove the
mainmethod and add proper junit tests instead. PreferParameterizedTests.
sure @vil02 , removed the main function and added tests!
Just a small tip: if you want to modify the last commit, you can use git commit --amend and then just push your changes with --force.
Happy hacktoberfest!
Just a small tip: if you want to modify the last commit, you can use
git commit --amendand then just push your changes with--force.Happy hacktoberfest!
Thanks @vil02, didn't know this....will surely use this in the future!