Hey, it’s your favorite cult leader here 🐱👤
On Wednesdays, I will send you a hand-picked problem for you to solve. The solutions will be sent on the following day. Use the weekly problems as a guide way to get some consistency in your life.
To get access to all my articles and support my crippling chocolate milk addiction, consider subscribing if you haven’t already!
p.s. you can learn more about the paid plan here.
We’re at problem 75!! This newsletter has come such a long way.
Very soon, we’re going to run out of meaningful Leetcode problems to solve (there are thousands on problems, but you only need 60-90 to be beefy and ace 95% of your interviews). I don’t want to keep mindlessly sending y’all problems for the sake of it, because that will just add to the noise. Better to focus on the important problems already covered.
It goes without saying, but I will still be solving any problems that you struggle with. I will also keep sharing interesting and meaningful problems from my end, as I come across them. I just want to know how y’all would like to proceed when I have covered all the most impactful Leetcode problems.
Now back to the problem.
This problem can be found as problem 143. Reorder List
Problem
You are given the head of a singly linked-list. The list can be represented as:
L0 → L1 → … → Ln - 1 → Ln
Reorder the list to be on the following form:
L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → …
You may not modify the values in the list's nodes. Only nodes themselves may be changed.
Example 1:
Input: head = [1,2,3,4]
Output: [1,4,2,3]
Example 2:
Input: head = [1,2,3,4,5]
Output: [1,5,2,4,3]
Constraints:
The number of nodes in the list is in the range
[1, 5 * 104]
.1 <= Node.val <= 1000
You can test your solution here
That is it for this piece. I appreciate your time. As always, if you’re interested in reaching out to me or checking out my other work, links will be at the end of this email/post. If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here. And if you found value in this write-up, I would appreciate you sharing it with more people.
For those of you interested in taking your skills to the next level, keep reading. I have something that you will love.
Upgrade your tech career with a premium subscription ‘Tech Made Simple’! Stay ahead of the curve in AI, software engineering, and tech industry with expert insights, tips, and resources. 20% off for new subscribers by clicking this link. Subscribe now and simplify your tech journey!
Using this discount will drop the prices-
800 INR (10 USD) → 533 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year
Reach out to me
Use the links below to check out my other content, learn more about tutoring, reach out to me about projects, or just to say hi.
If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here.
To help me understand you fill out this survey (anonymous)
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let’s connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819