-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
created max-twin-sum-in-list #1837 #1900
Conversation
In a linked list with an even number of nodes (size n), certain nodes are designated as "twins." Specifically, the i-th node (starting from index 0) is paired with the (n−1−i)-th node as its twin, for all i such that 0≤i≤(n/2)-1. In other words, the first node is paired with the last node, the second node with the second-last node, and so on, up to the midpoint of the list.
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible.). If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
We are given the head of a linked list, and an integer k. Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end (the list is 1-indexed).
⚡️ Lighthouse Report for the Deploy Preview of this PR 🚀
|
Given the head of a linked list with `n` nodes, for each node, find the value of the next node that is strictly greater. If no such node exists, return 0 for that position. Return an integer array `answer` where `answer[i]` is the value of the next greater node of the `i`th node (1-indexed).
please review my pr so that i can have clarity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
🎉🎉 Thank you for your contribution! Your PR #1900 has been merged! 🎉🎉 |
In a linked list with an even number of nodes (size n), certain nodes are designated as "twins." Specifically, the i-th node (starting from index 0) is paired with the (n−1−i)-th node as its twin, for all i such that 0≤i≤(n/2)-1. In other words, the first node is paired with the last node, the second node with the second-last node, and so on, up to the midpoint of the list.
📥 Pull Request
Description
In a linked list with an even number of nodes, each node at index i is paired with the node at index n−1−i as its twin. The goal is to find the maximum "twin sum," which is the sum of the values of each pair. For example, in a list of 4 nodes, node 0 pairs with node 3, and node 1 pairs with node 2. The task is to find the maximum sum from all such pairs.
Fixes #1837
Type of change
Screen.Recording.2024-11-06.at.10.30.13.PM.mov
Checklist: