Added solution for linked list using arrays