Adding Elements to the End of a Singly Linked List

Published by BijogFc24 in

Create a method in a LinkedList class called push that adds an element to the end of the linked list and returns the added element. The LinkedList class is created for you.

Examples

push(1) ➞ 1

push(2) ➞ 2

push(3) ➞ 3

Notes

Element is a positive integer.

Watch a quick demo on how Edabit works.