Skip to content

Conversation

mihika632
Copy link

Pull Request for Swap Nodes in Pairs
Description

This PR adds the solution for the problem “Swap Nodes in Pairs”.
The approach uses an iterative method with a dummy node, swapping adjacent nodes by changing pointers rather than values. The solution efficiently handles empty lists, single-node lists, and general cases.

Dependencies: None, uses standard Python ListNode definition.

Time Complexity: O(n), where n is the number of nodes in the linked list (each node is visited once).

Space Complexity: O(1), only a few pointers are used, no extra data structures.

Put check marks:

Added problem & solution under correct topic.

Specified Space & Time complexity.

Specified difficulty level, tag & Note(if any).

How Has This Been Tested?

Tested with multiple examples:

[1,2,3,4] → [2,1,4,3]

[] → []

[1] → [1]

[1,2,3] → [2,1,3]

Guidelines Checklist

My code follows the style guidelines of this project

I have performed a self-review of my own code

I have commented my code so that it is easy to understand

I have made corresponding changes to the documentation

My changes generate no new warnings

Any dependent changes have been merged and published in downstream modules

Pull Request for Divide Two Integers
Description

This PR adds the solution for the problem “Divide Two Integers”.
The approach uses bit manipulation and repeated subtraction to calculate the quotient without using *, /, or % operators.
It handles edge cases such as overflow and negative results efficiently.

Dependencies: None, uses standard Python integer operations.

Time Complexity: O(log(dividend)^2), because the divisor is doubled each time in repeated subtraction.

Space Complexity: O(1), only constant extra variables are used.

Put check marks:

Added problem & solution under correct topic.

Specified Space & Time complexity.

Specified difficulty level, tag & Note(if any).

How Has This Been Tested?

Tested with multiple examples:

dividend = 10, divisor = 3 → 3

dividend = 7, divisor = -3 → -2

Edge case: dividend = -231, divisor = -1 → 231-1

Guidelines Checklist

My code follows the style guidelines of this project

I have performed a self-review of my own code

I have commented my code so that it is easy to understand

I have made corresponding changes to the documentation

My changes generate no new warnings

Any dependent changes have been merged and published in downstream modules

GouravRusiya30 and others added 4 commits April 22, 2023 17:49
Implement a solution to swap adjacent nodes in a linked list using a dummy node for edge cases.
Implement division of two integers using bit manipulation and handle edge cases.
Copy link

welcome bot commented Oct 4, 2025

I can tell this is your first pull request! Thank you I'm so honored. 🎉🎉🎉 I'll take a look at it ASAP!

@GouravRusiya30
Copy link
Member

Thanks, I see that you haven’t updated Readme for the other 2 python files.

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.

3 participants