Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 individual nodes created, this PR links the nodes together. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions LinkedListPalindrome/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Suppose we have a singly-linked list (so you can only traverse the list in one direction) class where each list node contains a single character or integer. Implement a function to check if the elements in the linked list form a palindrome.

For example, given the linked list below:

```js
class ListNode {
constructor(value) {
Expand All @@ -16,9 +17,13 @@ const b = new ListNode(2);
const c = new ListNode(3);
const d = new ListNode(2);
const e = new ListNode(1);
a.next = b;
b.next = c;
c.next = d;
d.next = e;

isLinkedListPalindrome(a); // should return true
isLinkedListPalindrome(b); // should return false since now the 'a' node is not included in the linked list
isLinkedListPalindrome(a); // should return true
isLinkedListPalindrome(b); // should return false since now the 'a' node is not included in the linked list
```

Analyze the time and space complexity of your solution.
Analyze the time and space complexity of your solution.