# The Zen of grinding LeetCode problems: Day 143–Odd and even links

Welcome back to the LeetCode daily practice series. Today I did 1 Medium problem. Let’s begin!

# Odd Even Linked List

Insights:

• The approach to solving this problem involves using 2 pointers: one for even indices and the other for odd indices. We move them in parallel and we rearrange the connections so that they point to the correct nodes.
• Finally, after the reordering of the links is done, we must also connect the last odd node to the first even one, such that we end up with only one list.

--

--

# The Zen of grinding LeetCode problems: Day 142–Removing duplicates from linked list

Welcome back to the LeetCode daily practice series. Today I did 1 Easy problem. Let’s begin!

# Remove Linked List Elements

Insights:

• It is easiest to remove a node by connecting the current one to the one after it. However, this cannot be applied to the first node, so we must do a separate check.

--

--

# The Zen of grinding LeetCode problems: Day 140–Numbers

Welcome back to the LeetCode daily practice series. Today I did 1 Easy problem. Let’s begin!

# Self Dividing Numbers

Insights:

• The problem is rather straightforward: check the condition for each number in said interval. What’s most important in approaching a task like this is to approach it in a modular fashion, as it’s much easier to later modify the code to try out numbers in a given list rather than an interval.

--

--

# The Zen of grinding LeetCode problems: Day 139–Shifting lists

Welcome back to the LeetCode daily practice series. Today I did 1 Medium problem. Let’s begin!

# Rotate List

Insights:

• There are 3 steps to shifting the list the way the problem asks. First, we have to find outs its length. Second, we have to move through the list a specific number of indices. Finally, we cut the list at that position and continue iterating through the list until we end up back where we started.

--

--

## Dan M.

145 Followers

Data Scientist, likes learning new things