# Merge Two Sorted Lists

## Iterative

Walk through two lists and append the smaller node to the end of the final list. If exhaust one list, append the other list directly to the final list. 240 more words

Walk through two lists and append the smaller node to the end of the final list. If exhaust one list, append the other list directly to the final list. 240 more words

Since the environment is done, we can utilise our environment vector to create a route-pathing algorithm for our AI. Our vector already contains information regarding whether a cell contains an obstacle or not, so we can use this to our advantage. 424 more words

Two pointers prev and curr, walk through the array until curr hits null. Each time 1) save next, revert curr’s next to prev. 71 more words

Given two linked lists, find the first node the two lists intersect. Return null if they do not intersect.

This is the naive solution uses a hash set. 95 more words

Given a sorted linked list, remove duplicates such that each element only exists once.

Maintain two pointers, prev and curr, whiling walking the list. If curr’s value is equal to prev’s value, remove curr. 16 more words

Before you start designing your data structure it is a good idea to first stop and think about what you want to use it for. If you require a simple structure to store your data before applying a function to each element of data (also called… 1,632 more words

Implement get and set API for a LRU cache.

Use doubly linked list + hash map to solve. Hash map stores key to node mapping. 377 more words