
Solving the LeetCode N‑Queens Problem
Solve the N‑Queens problem with TypeScript. This article explains the backtracking method and provides a step‑by‑step code solution. Ideal for web developers.
Articles
LeetCode is a platform intended for preparing for technical coding interviews and improving coding skills. It presents hundreds of complex (and some less‑complex) problems, and invites users to submit solutions using the programming language of choice. Naturally, where I discuss solutions here, it will almost always be in a front‑end language like JavaScript or TypeScript...
Below you will find a subset of articles from my blog specifically about LeetCode. This is an area that I have worked with for many years, and have managed to write about quite a few times. There are fifty collected together for you below.

Solve the N‑Queens problem with TypeScript. This article explains the backtracking method and provides a step‑by‑step code solution. Ideal for web developers.

How to solve Kth Smallest Element in a BST by leaning on in‑order traversal instead of extra sorting the tree already makes unnecessary in interviews.

Solve Combination Sum with backtracking in TypeScript, using a growing path, remaining total, sorted pruning, reuse rules, and common mistakes too.

A clear walkthrough of LeetCode Jump Game using a greedy algorithm, including why the farthest‑reach approach works and where slower ideas get stuck.

How to solve LeetCode Coin Change with dynamic programming, and why the obvious greedy approach fails on exactly the cases worth understanding in interviews.

The diameter of a binary tree is the longest path between any two nodes. I'll explain clearly how we can solve this problem using recursion in JavaScript.

How to solve Course Schedule with topological sort in TypeScript, comparing Kahn's algorithm with DFS cycle detection and why in‑degrees read clearly.

Solve Rotting Oranges with multi‑source BFS in TypeScript, treating each queue level as one minute and tracking fresh cells until spread completes.

Solve Kth Largest Element in an Array with Quickselect in TypeScript, comparing sorting, heaps, partitioning, random pivots, and trade‑offs under pressure.

How to solve LeetCode Find Peak Element with binary search, and why local comparisons are enough even when the array is not sorted in the usual way.

The 'Course Schedule' problem tests our ability to detect cycles using graph traversal. I'll explain a clear solution using depth‑first search with TypeScript.

How to solve Search in Rotated Sorted Array with modified binary search, identifying the sorted half each step and narrowing safely in TypeScript.

The 'Merge Two Sorted Lists' problem on LeetCode involves combining two sorted linked lists into one. Here, I explore a clear solution with TypeScript examples.

Solve Koko Eating Bananas with binary search on the answer, using feasibility checks, speed bounds, ceiling division, TypeScript examples, and edge cases.

Solve Daily Temperatures with a monotonic stack in TypeScript, storing indices to find the next warmer day without repeated scanning and common mistakes.

Dive into solving the 'Generate Parentheses' problem using TypeScript. This guide covers the backtracking solution and explains each step in detail.

Implement a Trie prefix tree in TypeScript with Map‑based nodes, insert, search, startsWith, shared prefixes, complexity, and alternative child storage.

Solve Binary Tree Zigzag Level Order Traversal with breadth‑first search, level sizing, alternating output order, and TypeScript implementation details.