Code Problem / Data Structures and Algorithms / Linked Lists

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Code Problem / Data Structures and Algorithms DifficultyMedium C#
To reverse a linked list in place, we need to keep track of the current node, as well as the previous and next nodes. We can then change the pointers of the current node to point to the previous node, and move on to the next node.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The approach is not clear.
Nov 26
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem deals with removing duplicate elements from a linked list. An example input and output are given.
About this solution: The candidate's solution correctly removes duplicates from a linked list. The approach is straightforward and easy to follow.
Nov 26
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to reverse a linked list. An example input and output is given.
About this solution: This solution is complete and correctly solves the problem. The approach is to reverse the nodes in the list by changing the pointers so that the next node points to the previous node.
Nov 25
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks whether a singly linked list is a palindrome, meaning that the data in the list is the same forwards as it is backwards. An example input is provided, along with the expected output.
About this solution: The candidate's solution correctly determines whether a singly linked list is a palindrome. The candidate uses a fast and slow pointer to find the middle of the list, and then uses a stack to store the first half of the list. The candidate then compares the second half of the list with the values in the stack. This is a correct approach to solving the problem.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Given a singly linked list, this function will delete the head node and return the new head node.
About this solution: The candidate's solution correctly removes the head node from a singly linked list and returns the new head node. The solution is complete and correctly solves the problem. The candidate's approach is straightforward and easy to understand.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks whether or not a singly linked list is palindromic, meaning that the data contained within the list is the same whether read forwards or backwards. An example input is provided, along with the expected output.
About this solution: The candidate's solution correctly determines whether or not a singly linked list is palindromic. The candidate uses a fast and slow pointer to reach the middle of the list, and then uses a stack to store the first half of the list. The candidate then compares the second half of the list to the values in the stack. This is a valid approach to solving the problem.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Given a singly linked list, this function will delete the head node and return the new head node.
About this solution: The candidate's solution correctly removes the head node from the linked list and prints the value of the node. However, it is not clear what the expected output of the program is supposed to be. The candidate should clarify this before proceeding. Additionally, the candidate could improve the solution by providing more comments explaining the code.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Reversing a linked list involves iterating through the list and reversing the order of the nodes. This can be done by changing the next pointers of the nodes so that they point to the previous node in the list.
About this solution: The candidate's solution is correct and uses O(n) space and time. The candidate's approach is to use a stack to store the nodes in reverse order.
Nov 23