Add docstring and type hints to two_sum
Description
This pull request adds a detailed docstring and type hints to the two_sum
implementation in the arrays section.
The changes improve code readability and maintainability while keeping the existing algorithm logic unchanged.
Changes Made
- Added a clear docstring explaining the approach
- Added type hints for better clarity
Checklist
- [x] Code follows repository style guidelines
- [x] No functional changes were made
It seems to be not finished, e.g., return statement is missing.
No , you can see return statement inside the loop if two sum == target it will return , why inside loop because there is always going to have one valid two sum that's equal to target ,if there is no two sum in the array it will raise the value error at the end this is just optional , because in two sum problem there is always going to have one valid two sum pair
Great job adding docstrings and type hints to the two_sum implementation. This makes the code much more professional and easier for others to use and maintain. The explanation of the hash map approach is very helpful. Approved!
Thank you