LeetCode - 150 - Max Area of Island

The problem You are given an m x n binary matrix grid. An island is a group of 1s (representing land) connected 4-directionally (horizontally or vertically). You may assume all four edges of the grid are surrounded by water. The area of an island is the number of cells with a value 1 in the island. Return the maximum area of an island in grid. If there is no island, return 0. ...

October 6, 2025 · 3 min · Dmytro Chumakov

LeetCode - 150 - Reverse Nodes in k-Group

The problem Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then the left-out nodes at the end should remain as they are. You may not alter the values in the list’s nodes, only nodes themselves may be changed. ...

October 1, 2025 · 4 min · Dmytro Chumakov

LeetCode - 150 - N-Queens

The problem The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order. Each solution contains a distinct board configuration of the n-queens’ placement, where 'Q' and '.' both indicate a queen and an empty space, respectively. ...

September 26, 2025 · 6 min · Dmytro Chumakov

LeetCode - 150 - Letter Combinations of a Phone Number

The problem Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Examples Input: digits = "23" Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"] Input: digits = "" Output: [] Input: digits = "2" Output: ["a","b","c"] Constraints 0 <= digits.length <= 4 digits[i] is a digit in the range [‘2’, ‘9’] Explanation From the description of the problem, we learn that we are given a string with digits from 2-9 and we need to return all possible combinations that the number could represent. ...

September 15, 2025 · 2 min · Dmytro Chumakov

LeetCode - 150 - Palindrome Partitioning

The problem Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitionings of s. A substring is a contiguous non-empty sequence of characters within a string. A palindrome is a string that reads the same forward and backward. Examples Input: s = "aab" Output: [["a","a","b"],["aa","b"]] Input: s = "a" Output: [["a"]] Constraints 1 <= s.length <= 16 s contains only lowercase English letters. Explanation From the description of the problem we learn that we are given string s that we need to partition in a way that all substrings are palindromes. ...

September 12, 2025 · 3 min · Dmytro Chumakov