Skip to content

Arrays#4

Open
IshaAggarwalDev wants to merge 63 commits intomainfrom
Arrays
Open

Arrays#4
IshaAggarwalDev wants to merge 63 commits intomainfrom
Arrays

Conversation

@IshaAggarwalDev
Copy link
Owner

No description provided.

Implemented the Two Sum problem using a brute-force technique.
The solution iterates through all possible pairs using nested loops to identify the indices whose sum equals the target.
Time Complexity: O(n²)
Space Complexity: O(1)
Solved the Two Sum problem using an optimized HashMap approach.
The solution iterates through the array once while storing previously seen elements in a HashMap.
For each element, the complement (target − current value) is calculated and checked in the map to find the required pair efficiently.
This reduces the time complexity from O(n²) to O(n).

Time Complexity: O(n)
Space Complexity: O(n)
Implemented the Two Sum problem using a brute-force technique.
The solution iterates through all possible pairs using nested loops to identify the indices whose sum equals the target.
Time Complexity: O(n²)
Space Complexity: O(1)
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.

1 participant