You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right, and return the reversed list.
Time complexity: O(n)
Space complexity: O(1)
*/
class Solution {
public:
ListNode* reverseBetween(ListNode* head, int left, int right) {