---
title: "#leetcode articles | Hashnode"
description: "Explore 3,103 articles tagged #leetcode on Hashnode. Tutorials, guides, and how-tos from the community."
url: "https://hashnode.com/tag/leetcode"
---

Tag

# #leetcode

3,103 posts · 250 followers

[Mayank Mahajan](https://hashnode.com/@Mayank9056) · [5d ago](https://hashnode.com/posts/stop-solving-array-problems-randomly-5-patterns-every-developer-should-know/6aedac9c062c45f442ef190e)

### [Stop Solving Array Problems Randomly: 5 Patterns Every Developer Should Know](https://mayankdev.hashnode.dev/stop-solving-array-problems-randomly-5-patterns-every-developer-should-know?utm_source=hashnode&utm_medium=feed)

A practical guide to Two Pointers, Sliding Window, Prefix Sum, Kadane's Algorithm, and how to recognize the right pattern before writing code

12 min read · [mayankdev.hashnode.dev](https://mayankdev.hashnode.dev/stop-solving-array-problems-randomly-5-patterns-every-developer-should-know?utm_source=hashnode&utm_medium=feed)

[Linkjob AI](https://hashnode.com/@linkjob) · [Nov 4](https://hashnode.com/posts/matrix-diagonal-sum-leetcode-1572-one-loop-one-center-check/6aeb5d13a4143456380910c9)

### [Matrix Diagonal Sum (LeetCode 1572): One Loop, One Center Check](https://linkjob-ai.hashnode.dev/matrix-diagonal-sum-leetcode-1572-one-loop-one-center-check?utm_source=hashnode&utm_medium=feed)

Problem. Given a square matrix mat, return the sum of its primary diagonal and its secondary diagonal. If the size is odd, the center cell sits on both diagonals, so count it only once. The idea For r

2 min read · [linkjob-ai.hashnode.dev](https://linkjob-ai.hashnode.dev/matrix-diagonal-sum-leetcode-1572-one-loop-one-center-check?utm_source=hashnode&utm_medium=feed)

[Linkjob AI](https://hashnode.com/@linkjob) · [Nov 3](https://hashnode.com/posts/longest-harmonious-subsequence-leetcode-594-count-once-check-neighbours/6aea592c996c1dfff7cb4ff1)

### [Longest Harmonious Subsequence (LeetCode 594): Count Once, Check Neighbours](https://linkjob-ai.hashnode.dev/longest-harmonious-subsequence-leetcode-594-count-once-check-neighbours?utm_source=hashnode&utm_medium=feed)

A harmonious array is one where the maximum and minimum differ by exactly 1. Given an array, return the length of its longest harmonious subsequence. The word "subsequence" is the whole trick: order d

2 min read · [linkjob-ai.hashnode.dev](https://linkjob-ai.hashnode.dev/longest-harmonious-subsequence-leetcode-594-count-once-check-neighbours?utm_source=hashnode&utm_medium=feed)

[Linkjob AI](https://hashnode.com/@linkjob) · [Nov 3](https://hashnode.com/posts/palindrome-linked-list-leetcode-234-o-1-space-without-losing-the-list/6aea23d1cadde8ab9055a509)

### [Palindrome Linked List (LeetCode 234): O(1) Space Without Losing the List](https://linkjob-ai.hashnode.dev/palindrome-linked-list-leetcode-234-o-1-space-without-losing-the-list?utm_source=hashnode&utm_medium=feed)

Given the head of a singly linked list, return true if it reads the same forward and backward. Easy version: copy to an array Push every value into a list and compare it with its reverse. That's O(n)

2 min read · [linkjob-ai.hashnode.dev](https://linkjob-ai.hashnode.dev/palindrome-linked-list-leetcode-234-o-1-space-without-losing-the-list?utm_source=hashnode&utm_medium=feed)

[Gowtham Muthuvel](https://hashnode.com/@GowthamMuthuvel) · [Oct 27](https://hashnode.com/posts/java-comparator-a-minus-b-overflow-bug/6ae06f18fe43b5b6b39e8cc2)

### [Why (a, b) -> a - b Is a Bug in Java Comparators](https://gowthammuthuvel.hashnode.dev/java-comparator-a-minus-b-overflow-bug?utm_source=hashnode&utm_medium=feed)

a - b comparators overflow and silently mis-sort lists and heaps. Real Java output, the long/double cast traps, and the one-line fixes.

8 min read · [gowthammuthuvel.hashnode.dev](https://gowthammuthuvel.hashnode.dev/java-comparator-a-minus-b-overflow-bug?utm_source=hashnode&utm_medium=feed)

[Mayank Mahajan](https://hashnode.com/@Mayank9056) · [Oct 9](https://hashnode.com/posts/maximum-width-of-a-binary-tree-counting-the-nodes-that-aren-t-there/6ac9254cb8f25ffd2bd94a31)

### [Maximum Width of a Binary Tree: Counting the Nodes That Aren't There](https://mayankdev.hashnode.dev/maximum-width-of-a-binary-tree-counting-the-nodes-that-aren-t-there?utm_source=hashnode&utm_medium=feed)

A BFS story about empty positions, heap-style indexes, and why re-basing keeps your numbers small.

5 min read · [mayankdev.hashnode.dev](https://mayankdev.hashnode.dev/maximum-width-of-a-binary-tree-counting-the-nodes-that-aren-t-there?utm_source=hashnode&utm_medium=feed)

[Mayank Mahajan](https://hashnode.com/@Mayank9056) · [Oct 9](https://hashnode.com/posts/lowest-common-ancestor-of-a-binary-tree-leetcode-236-explained-simply-in-c/6ac8ff373d1abe2aedd8e660)

### [Lowest Common Ancestor of a Binary Tree (LeetCode 236) Explained Simply in C++](https://mayankdev.hashnode.dev/lowest-common-ancestor-of-a-binary-tree-leetcode-236-explained-simply-in-c?utm_source=hashnode&utm_medium=feed)

From the family-tree idea to a 10-line recursive solution, step by step

10 min read · [mayankdev.hashnode.dev](https://mayankdev.hashnode.dev/lowest-common-ancestor-of-a-binary-tree-leetcode-236-explained-simply-in-c?utm_source=hashnode&utm_medium=feed)

[Mayank Mahajan](https://hashnode.com/@Mayank9056) · [Oct 6](https://hashnode.com/posts/binary-tree-right-side-view-one-node-per-level/6ac53d9bcaa83d2cebce552b)

### [Binary Tree Right Side View: One Node Per Level](https://mayankdev.hashnode.dev/binary-tree-right-side-view-one-node-per-level?utm_source=hashnode&utm_medium=feed)

Understand LeetCode 199 once, then solve it twice with right-first DFS and level-order BFS.

10 min read · [mayankdev.hashnode.dev](https://mayankdev.hashnode.dev/binary-tree-right-side-view-one-node-per-level?utm_source=hashnode&utm_medium=feed)

[Abirami Sri](https://hashnode.com/@abiramisri) · [Sep 24](https://hashnode.com/posts/day-13-of-my-dsa-journey-linked-list-operations-pointer-manipulation/6ab54aaccd059cf45bd83383)

### [Day 13 of My DSA Journey — Linked List Operations & Pointer Manipulation](https://abi-blog.hashnode.dev/day-13-of-my-dsa-journey-linked-list-operations-pointer-manipulation?utm_source=hashnode&utm_medium=feed)

Linked List patterns by solving Design Linked List, Remove Nth Node From End, Rotate List, and Odd Even Linked List using dummy nodes & 2 pointers.

13 min read · [abi-blog.hashnode.dev](https://abi-blog.hashnode.dev/day-13-of-my-dsa-journey-linked-list-operations-pointer-manipulation?utm_source=hashnode&utm_medium=feed)

[Abirami Sri](https://hashnode.com/@abiramisri) · [Sep 23](https://hashnode.com/posts/day-12-0f-my-dsa-journey-with-javascript-linked-list-patterns/6ab3aa2cd1aa95e0545d213f)

### [Day 12 0f My DSA Journey with JavaScript — Linked List Patterns](https://abi-blog.hashnode.dev/day-12-0f-my-dsa-journey-with-javascript-linked-list-patterns?utm_source=hashnode&utm_medium=feed)

Learn Linked List patterns in JavaScript by solving Reverse Linked List, Middle Node, Linked List Cycle, and Intersection of Two Linked Lists.

7 min read · [abi-blog.hashnode.dev](https://abi-blog.hashnode.dev/day-12-0f-my-dsa-journey-with-javascript-linked-list-patterns?utm_source=hashnode&utm_medium=feed)
