
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
Algorithms are the repeatable problem‑solving patterns we use when brute force is no longer good enough. In web development they show up far beyond interview prep: searching, sorting, caching, scheduling, parsing, and state‑heavy UI logic all rely on algorithmic judgement. A lot of the articles here overlap with LeetCode, but the category is broader than that; it is about learning the techniques that make difficult problems easier to reason about in JavaScript and TypeScript.
Below you will find a subset of articles from my blog specifically about Algorithms. This is an area that I have worked with for many years, and have managed to write about quite a few times. There are thirty‑nine 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.

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.

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.

Solve Binary Tree Level Order Traversal with breadth‑first search in TypeScript, using a queue, level sizing, edge cases, and cleaner iteration well.

Solve Word Search with backtracking in JavaScript, covering recursive path exploration, visited state, pruning, restoration, and grid trade‑offs.