This repository contains a collection of standard recursion problems implemented in Java. It is designed to help you understand and practice recursion by solving problems ranging from basic to advanced difficulty levels.
The repository includes the following recursion problems:
- Factorial: Calculate the factorial of a given number.
- Fibonacci: Generate the nth Fibonacci number.
- Sum of Digits: Compute the sum of digits of a given number.
- Power: Calculate the power of a number.
- Greatest Common Divisor: Find the greatest common divisor of two numbers.
- Tiling Problem: Calculate the number of ways to tile a given area using 1x2 tiles.
- Power of N: Calculate the power of a number raised to the nth power.
- First Occurrence of Element: Find the index of the first occurrence of a given element in an array.
- Remove Duplicates: Remove duplicates from an array.
- Permutations: Generate all permutations of a given string.
Each problem is implemented in Java and includes a detailed explanation and the corresponding recursive solution.
To use this repository, follow these steps:
- Clone the repository to your local machine using the following command:
git clone https://github.com/akanksha042/JAVA-Recursion.git
- Open the project in your favorite Java IDE.
- Navigate to the problem of your choice and explore the solution.
- Modify and experiment with the code as needed.
- Run the program to see the results and test different inputs.
- Learn from the comments and explanations provided in the code to understand the recursive approach.
Feel free to contribute to the repository by adding more recursion problems or improving existing solutions. Simply fork the repository, make your changes, and create a pull request.
Remember, practice is the key to mastering recursion. Happy coding!