Author: Editorial Team
-
LeetCode 171 — Excel Sheet Column Number
This problem is the reverse of LeetCode 168.Instead of converting a number to a column title, here you are given a column title (like used in Excel) and must convert it into the corresponding integer. Examples: Problem Understanding Excel column titles behave like a base-26 number system, but instead of digits 0–25, letters represent values…
-
LeetCode 994 — Rotting Oranges
You are given a grid where each cell represents: Every minute, any fresh orange that is adjacent (up, down, left, right) to a rotten orange also becomes rotten. Your task: Return the minimum number of minutes required for all oranges to become rotten.If it is impossible, return -1. Example: Problem Understanding and Key Observations Important…
-
LeetCode 437 — Path Sum III
This problem asks you to count how many paths in a binary tree have a sum equal to a given target value. The path: Example: The three valid paths are: Problem Requirements and Observations Important characteristics: Constraints: Logic Explained in Simple English There are two common ways to solve this: Approach A: Simple Recursive Counting…
-
LeetCode 987 — Vertical Order Traversal of a Binary Tree
Vertical Order Traversal means we must print nodes column by column, from leftmost vertical line to rightmost. But unlike the simpler vertical order problem, this one has strict ordering rules. Given a binary tree, return the vertical traversal such that: Example: How Coordinates Work We treat the tree as a grid: Example coordinate mapping: Now…
-
LeetCode 442 — Find All Duplicates in an Array
You are given an array of integers where: Your task:Return all elements that appear exactly twice in the array, without using extra space proportional to n. Example: Problem Requirements and Constraints This means: Logic Explained The key insight: Since all numbers are between 1 and n, each number corresponds to a valid index in the…
-
LeetCode 211 — Design Add and Search Words Data Structure
Build a data structure that can store words and search them, but with a twist: the search function must support the dot character . which can match any single letter. Example: Problem Requirements You must implement a class with two methods: addWord(word) Stores a word in the data structure. search(pattern) Returns true if: Constraints to…
-
LeetCode 974: Subarrays Divisible by K
1. Introduction This problem asks you to count how many contiguous subarrays in an integer array have a sum divisible by a given integer K. The subarray must be continuous, and the sum must satisfy the condition: (sum % K == 0) Example inputs and outputs: Input: nums = [4,5,0,-2,-3,1], K = 5Output: 7 The…
-
LeetCode 342: Power of Four
1. Introduction LeetCode Problem 342 asks you to determine whether a given integer is a power of four. A number qualifies if it can be expressed as 4ⁿ for some non-negative integer n. Examples of valid results include 1, 4, 16, 64, 256, and so on. The task is to return true if the number…
-
Problem 168: Excel Sheet Column Title
You are given a positive integer columnNumber, and you must return its corresponding Excel column title. Excel columns work like this: 1 → A2 → B3 → C…26 → Z27 → AA28 → AB…52 → AZ53 → BA… This is essentially a base-26 conversion, but with a twist:There is no zero, and Excel uses 1–26…
-
Problem 125: Valid Palindrome
You are given a string s.Your task is to determine whether it is a valid palindrome after: Ignoring all non-alphanumeric charactersConverting all letters to lowercase A palindrome reads the same forwards and backwards. Understanding the Problem We only care about: A–Z, a–z0–9 All other characters (spaces, commas, punctuation, etc.) must be skipped. Examples: Input: “A…
