Word Search (LeetCode 79)
The problem You get a grid of letters and a . Return if the word can be spelled…
Tag
388 posts
The problem You get a grid of letters and a . Return if the word can be spelled…
The problem You get a grid of letters and a list of words. Return every word…
The problem You get a grid where is a wall, is a gate, and (2147483647) is an…
The problem You get a word, an word and a list of allowed words . A…
The problem You get a string and a list of words . Return if can be cut into…
The problem You get a 9×9 Sudoku board as a list of lists of strings. Each cell…
The problem You get the root of a binary tree. Return if it is a valid binary…
The problem You get a string of , and . Each can act as , as , or as nothing…
The problem You get a string that can contain letters, digits, spaces and…
The problem You get a string made only of the characters . Return if the…
The problem You get an grid of 0s and 1s, where is an obstacle. A robot starts…
The problem You get two strings and . Return if is an anagram of , meaning it…
The problem You get an array of integers and an integer . Return the indices of…
The problem A robot starts at the top-left corner of an grid and wants to reach…
The problem You get an array sorted in non-decreasing order and a . Exactly one…
The problem You get an array of non-negative integers; each is the height of a…
The problem You get a list of tasks, each a capital letter, and a cooldown . The…
The problem Design a class with two methods: stores for at time . returns…
The problem You get an grid where is the elevation of that cell; the values…
The problem You get a grid of and . A region of cells (connected up, down…
The problem You get the of a linked list. Swap every two adjacent nodes and…
The problem Return for two integers without using the or operators. On…
The problem You get two binary trees, and . Return if contains a node whose…
The problem You get a list of distinct integers. Return every possible subset of…
The problem You get an array of distinct integers. Return every possible subset…
The problem You get a list of integers that may contain duplicates. Return every…
The problem Given an integer array (values may be negative) and an integer…
The problem You get an integer array (values may be negative) and an integer…
The problem You get an integer array and an integer . Return the values that…
The problem An attendance record is a string of (present), (absent) and (late…
The problem Piles of stones sit in a row. Alice and Bob take turns, Alice first…
The problem You get an integer array sorted in non-decreasing order. It may…
The problem You get an array of non-negative integers and an integer . Split…
The problem You get an array containing only , and (red, white and blue…
The problem You get an matrix. Return all its elements in clockwise spiral…
The problem You get an integer array and a window size . A window of…
The problem You get a string . Rearrange it so that characters appear in order…
The problem Design an array of a given , initially all zeros, that can take…
The problem You get an array where every value appears exactly twice, except two…
The problem You get an array where every value appears exactly three times…
The problem You get an undirected, connected graph with nodes as an adjacency…
The problem You get a non-empty array of integers. Every value appears exactly…
The problem You get a string . You may add characters only to the front of it…
The problem You want to encode a list of words as one string where each word is…
The problem You get an matrix of integers. Wherever a cell is 0, set its entire…
The problem Design a with two methods: turns a binary tree into a string…
The problem You get a sorted array of distinct integers and a . If is in the…
The problem An array of distinct integers was sorted in ascending order and then…
The problem You get an integer matrix with two properties: each row is sorted…
The problem You get a list of product names and a search word that the user…
The problem You get an grid where each cell is (empty), (fresh orange) or…
The problem You get the roots and of two binary trees. Return if they are the…
The problem You get the of a linked list and a non-negative integer . Rotate…
The problem You get a valid Roman numeral as a string made of (1, 5, 10, 5…
The problem You get the of a linked list and two 1-indexed positions . Reverse…
The problem You get the of a singly linked list. Reverse the list so the last…
The problem You get a square matrix. Rotate it 90° clockwise in place: you must…
The problem You get the of a linked list and a positive integer . Reverse the…
The problem You get a string of words separated by spaces. Return the words in…
The problem Given a string , decide whether it can be built by writing some…
The problem You get a signed 32-bit integer . Return it with its digits reversed…
The problem You get two strings and . Return the smallest number of times you…
The problem You get a list of roots (the dictionary) and a sentence of space…
The problem You get a string of lowercase letters. Rearrange its letters so…
The problem A DNA string uses only the letters , , and . Return every…
The problem You get a 32-bit unsigned integer . Reverse the order of its 32 bits…
The problem You get the of a singly linked list . Rearrange it in place into…
The problem You get the of a singly linked list and an integer . Remove the n…
The problem You get a non-negative integer as a string and an integer . Remove…
The problem You get an integer array sorted in non-decreasing order. Rearrange…
The problem You get the of a linked list sorted in ascending order. Remove…
The problem Implement matching for a pattern against a string , where: matches…
The problem You get a list of intervals . Interval is covered by if and…
The problem You get a list of airline tickets . Build the itinerary that starts…
The problem You get two strings, and . Each letter in the magazine can be used…
The problem You start with a tree on nodes to , then one extra edge is added…
The problem You are given an integer array that never changes. Build a class…
The problem Design a class that receives a stream of non-negative integers…
The problem You are given a matrix of integers that never changes. Build a class…
The problem Given an integer array , return an array where is the product of…
The problem You get a list of distinct integers. Return every possible ordering…
The problem Implement : raise a floating-point number to an integer power…
The problem You get a list of integers that may contain duplicates. Return every…
The problem A non-negative integer is stored as a list of its digits, most…
The problem You get a perfect binary tree: every internal node has exactly two…
The problem You get two strings and . Return if some contiguous piece of is a…
The problem You get an undirected graph with nodes. Edge joins and succeeds…
The problem You get a grid of . You start at the top-left cell and want to reach…
The problem You get the root of a binary tree and an integer . Return if some…
The problem You get an array of positive integers and a number . Decide whether…
The problem Given an array of positive integers, return if it can be split…
The problem Given a string of lowercase letters, split it into as many parts as…
The problem Given a string , count how many of its substrings are palindromes…
The problem Given a string , cut it into one or more pieces so that every piece…
The problem You get the of a singly linked list of integers. Return if the…
The problem You get an integer array and an integer . Cut the array into…
The problem You get a 2-D grid of (land) and (water). An island is a group of…
The problem Design a class whose method is called once per day with that day’s…
The problem You get a grid of heights. The Pacific touches the top and left…
The problem Given a non-negative integer (treated as an unsigned 32-bit value…
The problem Given a list of intervals , return the minimum number of intervals…
The problem You get nodes labelled to and a list of undirected . Return how…
The problem You get the of a linked list. Reorder it so all nodes at odd…
The problem Place queens on an chessboard so that no two attack each other: no…
The problem You get an integer array that is circular: after the last element…
The problem You get two arrays of distinct integers, and , where every value in…
The problem There are nodes labelled to . Each entry in is a directed edge…
The problem Design a calendar class with one method, . Each event is the half…
The problem You get two non-negative integers as strings, and . Return their…
The problem You get an array of distinct numbers taken from the range to…
The problem You get two strings and . Return the shortest substring of that…
The problem You get an integer array . Move all the s to the end in place, while…
The problem You get an grid of non-negative numbers. Walk from the top-left…
The problem You pick a positive integer , then add the numbers of to it one at…
The problem You get an array of positive integers and a positive integer…
The problem A wooden stick has length , with positions to . You must make every…
The problem You get the of a binary tree. Return its minimum depth: the number…
The problem Each balloon spans a horizontal range . An arrow shot straight up at…
The problem Design a stack class with four operations, each in O(1) time: puts…
The problem You get the heads of two linked lists, each already sorted in non…
The problem You get the of a singly linked list. Return the middle node. If the…
The problem You get an array of linked lists, each sorted in ascending order…
The problem You get an array , where is the price of stepping off step . You…
The problem You get points on a 2-D plane. Connecting two points costs their…
The problem You get a list of meetings, each as . Decide whether one person can…
The problem You get a list of triplets and a triplet. One operation picks two…
The problem You get a list of meetings . Return the minimum number of conference…
The problem Given a list of intervals , merge every group of overlapping…
The problem You get two sorted arrays (length ) and (length ). Return the…
The problem Given an integer array (at least one element, values can be…
The problem You get an array of non-negative integers. Return the largest value…
The problem You get jobs. Job runs from to and pays . Choose a set of jobs…
The problem Given an integer array (at least one element; values may be…
The problem Given an integer array (values can be negative) and an integer…
The problem You get the root of a binary tree. Return its maximum depth: the…
The problem You get an integer array and an integer . Among all contiguous…
The problem You get a matrix of characters and . Find the largest square made…
The problem You get a binary array (only 0s and 1s) and an integer . You may…
The problem Design a class: stores . If the key already exists, the new value…
The problem Design a class that stores up to key-value pairs and supports…
The problem You get an array of length . One value, the majority element…
The problem You get the root of a binary search tree and two values and that…
The problem You get a list of words. Find the longest word that can be built one…
The problem You get the root of a binary tree (not a BST) and two values and…
The problem You get a binary array . You must delete exactly one element. Return…
The problem You get an uppercase string and an integer . You may change up to…
The problem You get a string . Return the length of the longest substring…
The problem Given a string (at least one character), return the length of its…
The problem Given an integer array , return the length of the longest strictly…
The problem A happy prefix of a string is a non-empty prefix that is also a…
The problem Given a string of lowercase letters, return the longest substring…
The problem Given a string , return its longest contiguous substring that reads…
The problem You get an unsorted array of integers . Return the length of the…
The problem Given two strings and , return the length of their longest common…
The problem You get the of a singly linked list that may contain a cycle…
The problem You get the of a singly linked list. Some node’s may point back to…
The problem Design a cache with a fixed that supports, in O(1) average time…
The problem You get a list of strings. Return the longest string that is a…
The problem On an old phone keypad, each digit from 2 to 9 maps to a few letters…
The problem You get a list of stone weights. Each turn, take the two heaviest…
The problem You get an array of non-negative integers, the heights of bars in a…
The problem You get an integer array and an integer . Return the kth largest…
The problem You get the root of a binary search tree and an integer (1-indexed…
The problem Design a class . It starts with the numbers in . Each call to adds…
The problem There are of bananas, and is the size of pile . Koko picks an…
The problem You get two strings and of the same length. They are isomorphic if…
The problem You get a list of points on a plane and an integer . Return the k…
The problem You start at index 0 of an array of non-negative integers. is the…
The problem You stand at index 0 of an array . From index you may jump forward…
The problem You get the root of a binary tree. Invert it, meaning produce its…
The problem You get the heads of two singly linked lists, and . At some node…
The problem You get three strings , and . Return if can be formed by…
The problem You get two lists of closed intervals, and . Each list is sorted…
The problem Design a with three operations, each in O(1) average time: : add…
The problem Design a class with three methods: stores a word. returns only…
The problem Same rules as House Robber: is the money in house , and you cannot…
The problem Houses form a binary tree. Each node has a value (the money inside…
The problem Houses stand in a row and is the money in house (all values non…
The problem Take a positive integer . Replace it with the sum of the squares of…
The problem You hold a hand of cards, each with an integer value, and a number…
The problem There are stations on a circular road. Station gives you fuel…
The problem You get nodes labelled to and a list of undirected . Return if…
The problem Given , return every string of pairs of round brackets that is well…
The problem You get an board of cells, each 1 (live) or 0 (dead). Every cell…
The problem You get a list of non-overlapping intervals sorted by start, and one…
The problem A row of trees is given as an array , where is the type of fruit on…
The problem You get two strings, and . Return the index where first appears…
The problem There are cities numbered to , joined by weighted, undirected…
The problem You get an array of length . Every value is between and , and…
The problem Given an integer array , find the pivot index: the leftmost index…
The problem You get a list of strings . Group together the words that are…
The problem You get an integer array where no two neighbours are equal. A peak…
The problem A sorted array of distinct integers has been rotated some number of…
The problem You get two arrays and , both sorted in non-decreasing order, and…
The problem You get a string and a pattern . Return the list of every start…
The problem You get an array sorted in non-decreasing order (duplicates allowed…
The problem Design two functions. turns a list of strings into a single string…
The problem You have versions of a product. At some point one version went bad…
The problem You get a list of string tokens that form an arithmetic expression…
The problem You get each employee’s working schedule as a sorted list of non…
The problem Given two words and , return the minimum number of single-character…
The problem Design a class with two methods: adds a number from the stream…
The problem A knight starts at the top-left of a grid and must reach the…
The problem You get a string of lowercase letters. Return the index of the…
The problem You get the root of a binary tree. Return its diameter: the number…
The problem Given strings and , return the number of distinct ways to pick…
The problem Design a system that tracks passengers on a metro network…
The problem Design a circular queue with a fixed capacity . Support: : add at…
The problem Design a simplified Twitter with four operations: : the user posts a…
The problem Design a with two methods: stores a word of lowercase letters…
The problem Letters are encoded as numbers: , , …, . Given a string of digits…
The problem Implement a hash map for integer keys and values without using any…
The problem There are servers, numbered to , joined by undirected connections…
The problem You get an array of daily temperatures. For each day , return how…
The problem You get the of a binary tree with unique values, and two different…
The problem There are courses labelled to . Each pair in means “you must…
The problem There are courses labelled to . Each pair means “take before…
The problem Count the strings of length built from the vowels that follow…
The problem Given an array of non-negative integers and an integer , return if…
The problem Given a binary array (only 0s and 1s), return the length of the…
The problem Each node in a linked list has a , a pointer, and a pointer that…
The problem You get an array where is the height of a vertical wall at…
The problem Given an integer , return a list of length where is the number of…
The problem You get two lists for the same binary tree: its preorder traversal…
The problem You get a list of positive integers , which may contain duplicates…
The problem You get a list of distinct positive integers and a . Return every…
The problem Given two integers and , return every way to choose distinct…
The problem You are at the bottom of a staircase with steps. Each move climbs…
The problem There are cities and a list of , each (one-way). Find the cheapest…
The problem You get a circular array of non-zero integers. Standing on index…
The problem You get a list of coin denominations (unlimited supply of each) and…
The problem You get an array of integers . Return if any value appears at least…
The problem A car with empty seats drives in one direction. Each trip is : pick…
The problem Packages on a conveyor belt have weights and must be shipped in…
The problem Children stand in a line, each with a rating. Give out candies so…
The problem Given two integers (both between 0 and 2³¹ − 1), return the bitwise…
The problem Balloons in a row each carry a number. Bursting balloon earns…
The problem You get the of a binary tree. Return its values level by level, but…
The problem You get the root of a binary tree whose values can be negative. A…
The problem You get the of a binary tree. Imagine standing to its right and…
The problem You get an array where is a stock’s price on day . You may buy…
The problem You get the of a binary tree. Return its values level by level…
The problem You get an and a list of coin denominations (unlimited supply of…
The problem You get the of a binary tree. Return its values level by level, but…
The problem You get two strings and that were typed into a text editor. The…
The problem You get the of a non-empty binary tree. Return a list where the -th…
The problem Each child has a greed factor : the smallest cookie size that makes…
The problem You get an array of non-zero integers, each an asteroid in a row…
The problem An alien language uses lowercase English letters in an unknown order…
The problem You get an array of distinct integers sorted in ascending order…
The problem You get an integer array and a . Return every unique quadruplet…
The problem Two non-negative integers are stored as linked lists, one digit per…
The problem You get a list of accounts. Each account is a name followed by one…
The problem You get an integer array . Return every unique triplet of values…
The problem You get an integer array (at least three numbers) and a . Choose…
There are thousands of coding-interview questions but only about eighteen…
This is the third course in the trading-for-programmers set, alongside Options…
If you have done the Options Trading for Programmers course, this is its wild…
The capstone. We take the whole course — the linear payoff, cost of carry…
Finally, the part that is ours. The futures stack is mostly the same as any…
With the mechanics understood, we can run actual strategies. Futures are a…
Why does a Nifty future trade at 24,138 when the index is at 24,000? Not magic…
This lesson is the vocabulary and mechanics you must own. Futures are simpler…
This is the capstone. We assemble the whole course — market structure, perps…
Some interview questions don’t ask you to solve a problem — they ask you to…
Ten problems that drill the design-a-data-structure pattern from Lesson 27. Each…
You now have the whole toolkit — 24 patterns, each with a template, a diagram…
This is the advanced end of the string toolkit. Most string problems are solved…
Ten problems that drill the math & geometry pattern from Lesson 26 — the in…
Most interview questions are about data structures. This small but reliable…
By now you can define a state and a recurrence (Lessons 17–18). The DP problems…
Ten problems that drill the weighted-graph algorithms from Lesson 23. The…
Ten problems that drill KMP’s prefix function and Rabin-Karp’s rolling hash from…
Ten problems that drill bitmask, interval, and tree DP from Lesson 24. The work…
Eleven problems that drill the greedy pattern from Lesson 22. The real exercise…
Lessons 12–16 covered unweighted graphs, where BFS gives the shortest path…
Bit manipulation looks like a dark art, but it is really just one idea — an…
Greedy is the most dangerous pattern: the code is short and obvious, which makes…
Ten problems that drill the trie pattern from Lesson 20. Build the dict-of-dicts…
Ten problems that drill the bit manipulation tricks from Lesson 21. The whole…
A hash set can tell you whether an exact word exists, but it is useless the…
Part II of this course goes beyond the core 18 patterns into the structures and…
Thirteen problems that drill 1-D dynamic programming from Lesson 17. The hard 9…
Twelve problems that drill 2-D dynamic programming from Lesson 18 — two-sequence…
Dynamic programming scares people more than anything else — but it’s a single…
Graphs look intimidating, but interview graph problems reduce to four tools on…
The final pattern. When a problem involves two sequences or a grid, one index…
Backtracking is how you systematically explore all possibilities — generate…
Eleven problems that drill heaps / top-K from Lesson 14. The one trick to burn…
If BFS is for levels, DFS is for paths and subtrees — and almost every tree DFS…
When you need the biggest or smallest few — but not a full sort — a heap is the…
When a tree (or grid) problem is about levels or shortest distance, you want BFS…
Twelve problems that drill the graph toolkit from Lesson 16 — DFS, BFS…
Linked-list questions scare people, but almost all of them come down to one…
Everyone knows binary search on a sorted array. The reason it’s a pattern worth…
Thirteen problems that drill the binary-search pattern from Lesson 10 — the…
Ten problems that drill the breadth-first search / level-order pattern from…
Twelve problems that drill backtracking from Lesson 15. They all run the same…
Ten problems that drill the linked-list reversal / pointer-surgery pattern from…
Thirteen problems that drill tree DFS from Lesson 13. The skill is recursion…
Ten problems that drill the merge-intervals pattern from Lesson 8. The recipe is…
Ten problems that drill the prefix-sum pattern from Lesson 7. The big idea keeps…
Eleven problems that drill the stack and monotonic-stack pattern from Lesson…
Prefix sums are a quiet superpower: a tiny O(n) precomputation that makes every…
Thirteen problems that drill the hash map & frequency pattern from Lesson 6. The…
Any time you see pairs and the word “overlapping”, this is your pattern. The…
Ten problems that drill the fast & slow pointer pattern (Floyd’s tortoise-and…
Twelve problems that drill the sliding-window pattern from Lesson 4. The reps…
Sliding window is two pointers’ close cousin, specialised for contiguous sub…
Fast & slow pointers (Floyd’s “tortoise and hare”) is a small, elegant trick…
The hash map is the most useful data structure in interviews. The core move is…
The monotonic stack is the pattern people find magical: a plain stack, kept in…
Two pointers is the first pattern to master — it is simple, it appears…
Twelve problems that drill the two-pointer pattern from Lesson 3. The reps are…
Most options content online is either hand-wavy “buy this call and get rich…
Finally, the part that is ours. Everything so far — the maths, the strategies…
This is the capstone. We take everything — the basics, the Greeks, pricing…
An option’s price depends on several inputs — spot, strike, time, volatility…
Options are really instruments for trading volatility, so this lesson earns its…
Here is where the programmer’s edge really shows. The pricing of an option…
Two ideas in this lesson — moneyness and payoffs — and once they are in your…
Ask ChatGPT to “review this solution and tell me if I’d pass the interview” and…
Ask ChatGPT “where was Saturn when I was born, 2:30 pm on 15 August 1990 in New…
Every strategy so far produced signals — when to be long, short, or flat. But a…
Every strategy article so far asked ”what should I trade?” This one asks the…
The strategies so far used daily or minute bars. This last one goes down to the…
If algo trading has a “hello world,” it’s the moving-average crossover. Every…
Momentum is, along with value, one of the most robust and widely-documented…
The moving-average crossover bet on direction and lost. Here’s a strategy with a…
So far you’ve been a taker — crossing the spread to get filled. A market maker…
Data is the raw material of every strategy, and getting the right data is the…
Almost everything written about high-frequency trading is either breathless…
“Low latency” sounds like it should be about exotic tricks, but most of it is…
On a payments team I worked with, the table had a column called . Over three…
Here’s a bug I helped debug at a mid-sized ed-tech company. Some students were…
When I review payment integrations, I usually find the same three or four…
One evening during an IPL final, our support queue suddenly had 300 tickets with…
Every second LinkedIn post today is about AI agents. Most of them show a demo…
We’ve covered a lot over eleven lessons. In this one, I want to walk through how…
Here’s a conversation I’ve had, in some form, with almost every team building…
When the first million-token context windows arrived, a friend of mine (very…
When an agent misbehaves, the first instinct is to fiddle with the system prompt…
There’s a type of architecture diagram I’ve started to dread. It has a “CEO…
In the last lesson I said an agent is “an LLM in a loop choosing tools”. Today…
You already know how to program. You know loops, conditionals, functions, and…
Python’s error handling has two ideas you won’t find in most languages: the…
Python’s module system is straightforward once you understand the mechanics…
Python ships with an absurdly complete standard library — “batteries included…
Python’s OOP is fundamentally different from Java or C++. There are no access…
Functions in Python are objects. You can pass them around, store them in…
If you already know another language, half of Python will feel familiar. The…
Every office lobby has the same problem: a visitor walks in, nobody’s at the…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction There are some cases, where I need another git repository while…
Introduction This post has the complete code to send email through smtp server…
Introduction In a normal email sending code from python, I’m getting following…
Introduction In one of my app, I was using to talk to . I have used some event…
Introduction So you have a Django project, and want to run it using docker image…
Introduction It is very important to introduce few process so that your code and…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…
Introduction We often require to execute in timed manner, i.e. to specify a max…
Introduction To give some context, I have two python files. (Both in same folder…
Introduction Lets assume we have a csv something similar to following: Python…
Introduction In last post, we saw How to read CSV with Headers into Dictionary…
Introduction I was having a private artifactory, and has my custom modules…
Introduction In previous posts, we saw how to build FIPS enabled Openssl, and…
Introduction In this post, we will explore some useful command line options for…
Introduction In this post, we will see how we can apply a patch to Python and…
Introduction We will see how we can install Python 3.7 on Windows without UI. i…
Introduction We will see how we can install Python from command line using pyenv…
Introduction In this post, we will see Python 3.9.x patch for FIPS enabled…
Introduction In this post, we will see Python 3.7.9 patch for FIPS enabled…
Introduction In this post, we will see how we can build FIPS enabled openssl in…
Read file all in one shot Above code read whole file at once, but if the files…
Introduction In this tutorial we will see, How to list and download storage…
Introduction In this tutorial we will see: How to instantiate different classes…
Lets implement a command shell by using a command dispatcher. The objective is…
So, you want to run your code in parallel so that your can process faster, or…
This is regarding the timeit implementation in python. The basic requirement…
This post will show some really awesome tricks in python. Get the power of a…
This post some useful tips of using strings, and some issues while dealing with…
This post is dedicated for cases where we intend to append a variable value in a…
Pylint is an excellent tool to have good quality code. This post is not about…
I was testing a bug where a field was limited to 255 characters only. I needed…
While doing code review of one of junior, I encountered following code: What…


















































