Skip to content

Conversation

@kamakshipal1-tech
Copy link

(Description template was accidentally removed.)

📌 Description

This pull request adds a recursive implementation of the Tower of Hanoi problem in Java.

What is included:

  • Clean and readable Java code
  • Proper base case and recursive logic
  • Clear print statements showing each disk move
  • Time and space complexity mentioned in comments

Why this change:

  • To practice recursion concepts
  • To contribute a classic DSA problem solution
  • To improve code readability and learning value

Complexity:

  • Time Complexity: O(2^n)
  • Space Complexity: O(n) (recursion stack)

I would appreciate feedback on:

  • Code readability
  • Comments and naming
  • Any possible improvements

Thank you for reviewing! 🙌

📌 Description

This pull request adds a recursive implementation of the Tower of Hanoi problem in Java.

What is included:

  • Clean and readable Java code
  • Proper base case and recursive logic
  • Clear print statements showing each disk move
  • Time and space complexity mentioned in comments

Why this change:

  • To practice recursion concepts
  • To contribute a classic DSA problem solution
  • To improve code readability and learning value

Complexity:

  • Time Complexity: O(2^n)
  • Space Complexity: O(n) (recursion stack)

I would appreciate feedback on:

  • Code readability
  • Comments and naming
  • Any possible improvements

Thank you for reviewing! 🙌

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.87%. Comparing base (b76962d) to head (db3da53).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...java/com/thealgorithms/recursion/TowerOfHanoi.java 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7173      +/-   ##
============================================
- Coverage     78.91%   78.87%   -0.04%     
- Complexity     6853     6858       +5     
============================================
  Files           769      772       +3     
  Lines         22668    22693      +25     
  Branches       4456     4456              
============================================
+ Hits          17888    17899      +11     
- Misses         4067     4079      +12     
- Partials        713      715       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kamakshipal1-tech
Copy link
Author

Thanks for the checks! I’ll fix the clang-format issue and update the PR shortly.

@kamakshipal1-tech
Copy link
Author

I initially had only a clang-format failure.
While attempting to resolve it locally, additional build failures appeared.
I believe this is due to formatting/tooling issues rather than logic.
Guidance or maintainer-applied formatting would be appreciated.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants