Skip to content

Prepare For Coder Interview – Denny

  • Basic
  • Medium
  • Hard
  • Architect
  • Life

Review: Linked List Problems

Posted on January 22, 2018July 26, 2020 by braindenny

Linked List demands skills of managing pointers very well.

Most problems are not that hard for you to solve. But to get bug-free, you need to think it through.



Name Summary
How to sort a linkedlist Leverage an array of pointers

Top 5 Linkedlist Problems

Num Problem Summary
1 Merge k Sorted Lists LeetCode: Merge k Sorted Lists
2 Detect cycle for a linked list LeetCode: Linked List Cycle
3 Swap odd with even nodes Leetcode: Swap Nodes in Pairs
4 LFU cache with double linkedlist LeetCode: LFU Cache

Key Points:

  • Add a dummyNode, if head node might be changed
  • How to process current node?
Make sure the pointers are in-order
  • How to move to next node?
If you have changed the original node, the next pointer might not be what you want
  • Whether we need to maintain the previous node?

Common Problems:

  1. Insert a Node in Sorted List
  2. Remove a Node from Linked List 3. Reverse a Linked List
  3. Merge Two Linked Lists
  4. Find the Middle of a Linked List

The most impressive problems to me:

  • Sort List

  • CheatSheet: Leetcode For Code Interview
  • CheatSheet: Common Code Problems & Follow-ups

See all linkedlist problems: #linkedlist

  • Review: Linked List Problems
  • LintCode: Middle of Linked List
  • LintCode: Insert Node in Sorted Linked List
  • LintCode: Find Node in Linked List
  • LintCode: Count Linked List Nodes
  • LintCode: Convert Linked List to Array List
  • LintCode: Convert Array List to Linked List
  • LeetCode: Swap Nodes in Pairs
  • LeetCode: Strobogrammatic Number III
  • LeetCode: Split Linked List in Parts
  • LeetCode: Sort the Matrix Diagonally
  • LeetCode: Sort List
  • LeetCode: Rotate List
  • LeetCode: Robot Room Cleaner
  • LeetCode: RLE Iterator
  • LeetCode: Reverse Nodes in k-Group
  • LeetCode: Reverse Linked List II
  • LeetCode: Reverse Linked List
  • LeetCode: Reorder List
  • LeetCode: Remove Zero Sum Consecutive Nodes from Linked List
  • LeetCode: Remove Nth Node From End of List
  • LeetCode: Remove Linked List Elements
  • LeetCode: Remove Duplicates from Sorted List II
  • LeetCode: Remove Duplicates from Sorted List
  • LeetCode: Rearrange String k Distance Apart
  • LeetCode: Range Sum Query 2D – Mutable
  • LeetCode: Print Immutable Linked List in Reverse
  • LeetCode: Plus One Linked List
  • LeetCode: Partition List
  • LeetCode: Palindrome Linked List
  • LeetCode: Optimal Account Balancing
  • LeetCode: Odd Even Linked List
  • LeetCode: Numbers At Most N Given Digit Set
  • LeetCode: Nth Magical Number
  • LeetCode: N-Queens II
  • LeetCode: N-Queens
  • LeetCode: Minimum Window Subsequence
  • LeetCode: Minimum Time to Build Blocks
  • LeetCode: Middle of the Linked List
  • LeetCode: Merge Two Sorted Lists
  • LeetCode: Merge k Sorted Lists
  • LeetCode: Maximum Equal Frequency
  • LeetCode: LRU Cache
  • LeetCode: Longest Common Prefix
  • LeetCode: Linked List Cycle II
  • LeetCode: Linked List Cycle
  • LeetCode: Linked List Components
  • LeetCode: LFU Cache
  • LeetCode: Largest Plus Sign
  • LeetCode: Kth Smallest Element in a BST
  • LeetCode: Keyboard Row
  • LeetCode: K Empty Slots
  • LeetCode: Judge Route Circle
  • LeetCode: Intersection of Two Linked Lists
  • LeetCode: Intersection of Two Arrays II
  • LeetCode: Insertion Sort List
  • LeetCode: Insert into a Cyclic Sorted List
  • LeetCode: Flip Columns For Maximum Number of Equal Rows
  • LeetCode: Flatten Binary Tree to Linked List
  • LeetCode: Flatten a Multilevel Doubly Linked List
  • LeetCode: Encode String with Shortest Length
  • LeetCode: Encode N-ary Tree to Binary Tree
  • LeetCode: Divide Chocolate
  • LeetCode: Design Linked List
  • LeetCode: Delete Node in a Linked List
  • LeetCode: Copy List with Random Pointer
  • LeetCode: Convert Binary Search Tree to Sorted Doubly Linked List
  • LeetCode: Adding Two Negabinary Numbers
  • LeetCode: Add Two Numbers II
  • LeetCode: Add Two Numbers

See more blog posts.

linkedin
github
slack

Post Views: 9
Posted in ReviewTagged #linkedlist, review

Post navigation

Review: Binary Tree Problems
Review: Trie Tree Problems

Leave a Reply Cancel reply

Your email address will not be published.

Tags

#array #backtracking #bfs #binarytree #bitmanipulation #blog #classic #codetemplate #combination #dfs #dynamicprogramming #game #graph #greedy #heap #inspiring #interval #linkedlist #manydetails #math #palindrome #recursive #slidingwindow #stack #string #subarray #trie #twopointer #twosum binarysearch editdistance hashmap intervaldp knapsack monotone oodesign presum rectangle redo review rotatelist series sql treetraversal unionfind

Recent Posts

  • a
  • a
  • a
  • a
  • a

Recent Comments

    Archives

    Categories

    • Amusing
    • Basic
    • Easy
    • Hard
    • Life
    • Medium
    • Resource
    • Review
    • Series
    • Uncategorized
    Proudly powered by WordPress | Theme: petals by Aurorum.