Talentd/FleetCode/Problems/

3294. Convert Doubly Linked List to Array II

Medium
Read SolutionWatch Video

3294. Convert Doubly Linked List to Array II

Medium83.3% AcceptancePremium
PremiumFree on FleetCode

You are given an arbitrary node from a doubly linked list, which contains nodes that have a next pointer and a previous pointer.

Return an integer array which contains the elements of the linked list in order.

Example 1:

Input: head = [1,2,3,4,5], node = 5

Output: [1,2,3,4,5]

Example 2:

Input: head = [4,5,6,7,8], node = 8

Output: [4,5,6,7,8]

Constraints:

  • The number of nodes in the given list is in the range [1, 500].
  • 1 <= Node.val <= 1000
  • All nodes have unique Node.val.
Similar Questions

Loading editor...

[1,2,3,4,5]
5