Java icon indicating copy to clipboard operation
Java copied to clipboard

Adds Longest Arithmetic Subsequence Implementation

Open tejaswi0910 opened this issue 1 year ago • 2 comments

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

tejaswi0910 avatar Oct 01 '24 14:10 tejaswi0910

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.

codecov-commenter avatar Oct 01 '24 14:10 codecov-commenter

Please remove the main method and add proper junit tests instead. Prefer ParameterizedTests.

sure @vil02 , removed the main function and added tests!

tejaswi0910 avatar Oct 02 '24 09:10 tejaswi0910

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!

vil02 avatar Oct 03 '24 13:10 vil02

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!

Thanks @vil02, didn't know this....will surely use this in the future!

tejaswi0910 avatar Oct 04 '24 05:10 tejaswi0910