Welcome to the Coding and DSA Practice repository. This repository contains a collection of programming problems and their solutions, which have been curated for company-specific placement drives as well as general Data Structures and Algorithms (DSA) practice. These problems are provided by the Training and Placement Department to help learners prepare for technical interviews and coding assessments.
The repository is organized by programming languages, with each problem solution available in C, Java, and Python. Additionally, unit tests have been implemented for those interested in verifying the correctness of the solutions.
- C
- Java
- Python
Below is a list of some of the problems solved in this repository:
-
Check if a number is Even or Odd
-
Find Maximum Difference
( Given an arrayarr[]
of N positive integers, the task is to find the maximum ofj - i
subjected to the constraintarr[i] <= arr[j]
. ) -
Rearrange array in alternating positive & negative items with O(1) extra space
-
Find missing number from array
-
Concatenate given array twice
-
Find maximum sum path in two arrays
-
Find common elements in three arrays
-
Coming Soon ...
The complete problems statements are provided in Problems.txt file
.
Each problem has a dedicated program file with solutions in the three languages mentioned above. The solutions are designed to be clean and efficient, following best practices in programming.
Please note that, there can be multiple approaches to solve the same problem, and you can try them on your own!
Unit tests are available for the implemented solutions to ensure correctness. These tests can be found in the test/
directory and are written using popular testing frameworks like unittest
for Python, JUnit
for Java, and CMake
for C.
To run the unit tests, follow the instructions below based on your language of choice:
-
Python:
Navigate to thePython_Programs/test/
directory and run the tests usingunittest
:python -m unittest Program_1.py
-
Java: Use the
JUnit
framework to run the tests in theJava_Programs/test/
directory.javac Test_Program_1.java java Test_Program_1
-
C: Compile the test file along with the solution file and run the executable:
gcc -o test_Program_1 Program_1.c test_Program_1.c ./test_even_or_odd
- You need to adjust the file path accordingly...
- Change the file name to the program you want to run ...
- Try different test cases by editing the test cases files ...
I welcome contributions from the community to enhance this repository. If you have a solution in another language, or a more optimized solution, feel free to submit a pull request.
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-branch
- Submit a pull request.
For any queries or suggestions open an issue.