Challenge: Insertion at Tail

Try to solve the Insertion at Tail problem.

We'll cover the following

Statement

Given the head of a linked list and a target, value, return the updated linked list head after adding the target value at the end of the linked list.

Constraints:

Let n be the number of nodes in the linked list:

  • 00 \leq n 5×102\leq 5 \times 10^2

  • 5×103-5 \times 10^3 \leq node.data, value 5×103\leq 5 \times 10^3

Examples

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.