easy
2185. Counting Words With a Given Prefix
#Problem You are given an array of strings words and a string pref. Return the number of strings in words that contain pref as a prefix. A prefix of a string s is any leading contiguous substring of s. …
3042. Count Prefix and Suffix Pairs I
#Problem You are given a 0-indexed string array words. Let’s define a boolean function isPrefixAndSuffix that takes two strings, str1 and str2: isPrefixAndSuffix(str1, str2) returns true if str1 is both a prefix and a suffix of str2, and …
2264. Largest 3-Same-Digit Number in String
#Problem You are given a string num representing a large integer. An integer is good if it meets the following conditions: It is a substring of num with length 3. It consists of only one unique digit. Return the maximum good integer as a …
1408. String Matching in an Array
#Problem Given an array of string words, return all strings in words that is a substring of another word. You can return the answer in any order. A substring is a contiguous sequence of characters within a string. …
3019. Number of Changing Keys
#Problem You are given a 0-indexed string s typed by a user. Changing a key is defined as using a key different from the last used key. For example, s = "ab" has a change of a key while s = "bBBb" does not have any. Return the number of …
628. Maximum Product of Three Numbers
#Problem Given an integer array nums, find three numbers whose product is maximum and return the maximum product. https://leetcode.com/problems/maximum-product-of-three-numbers/ Example 1: Input: nums = [1,2,3] Output: 6 Example 2: Input: …
674. Longest Continuous Increasing Subsequence
#Problem Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasing. A continuous increasing subsequence is defined by two …
1128. Number of Equivalent Domino Pairs
#Problem Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d and b == c) - that is, one domino can be rotated to be equal to another domino. Return the …
1260. Shift 2D Grid
#Problem Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j + 1]. Element at grid[i][n - 1] moves to grid[i + 1][0]. Element at grid[m - 1][n …
1374. Generate a String With Characters That Have Odd Counts
#Problem Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times. The returned string must contain only lowercase English letters. If there are multiples valid strings, …
1437. Check If All 1's Are at Least Length K Places Away
#Problem Given an binary array nums and an integer k, return true if all 1’s are at least k places away from each other, otherwise return false. https://leetcode.com/problems/check-if-all-1s-are-at-least-length-k-places-away/ Example 1: …
292. Nim Game
#Problem You are playing the following Nim Game with your friend: Initially, there is a heap of stones on the table. You and your friend will alternate taking turns, and you go first. On each turn, the person whose turn it is will remove 1 …
171. Excel Sheet Column Number
#Problem Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 … Z -> 26 AA -> 27 AB -> 28 … …
168. Excel Sheet Column Title
#Problem Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 1 B -> 2 C -> 3 … Z -> 26 AA -> 27 AB -> 28 … https://leetcode.com/problems/excel-sheet-column-title/ Example …
1422. Maximum Score After Splitting a String
#Problem Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring). The score after splitting a string is the number of zeros in the left …
3280. Convert Date to Binary
#Problem You are given a string date representing a Gregorian calendar date in the yyyy-mm-dd format. date can be written in its binary representation obtained by converting year, month, and day to their binary representations without any …
3046. Split the Array
#Problem You are given an integer array nums of even length. You have to split the array into two parts nums1 and nums2 such that: nums1.length == nums2.length == nums.length / 2. nums1 should contain distinct elements. nums2 should also …
3083. Existence of a Substring in a String and Its Reverse
#Problem Given a string s, find any substring of length 2 which is also present in the reverse of s. A substring is a contiguous sequence of characters within a string. Return true if such a substring exists, and false otherwise. …
145. Binary Tree Postorder Traversal
#Problem Given the root of a binary tree, return the postorder traversal of its nodes’ values. https://leetcode.com/problems/binary-tree-postorder-traversal/ Example 1: Input: root = [1,null,2,3] Output: [3,2,1] Explanation: case1Example 2: …
3285. Find Indices of Stable Mountains
#Problem There are n mountains in a row, and each mountain has a height. You are given an integer array height where height[i] represents the height of mountain i, and an integer threshold. A mountain is called stable if the mountain just …
496. Next Greater Element I
#Problem The next greater element of some element x in an array is the first greater element that is to the right of x in the same array. You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2. …
1475. Final Prices With a Special Discount in a Shop
#Problem You are given an integer array prices where prices[i] is the price of the iᵗʰ item in a shop. There is a special discount for items in the shop. If you buy the iᵗʰ item, then you will receive a discount equivalent to prices[j] …
3264. Final Array State After K Multiplication Operations I
#Problem You are given an integer array nums, an integer k, and an integer multiplier. You need to perform k operations on nums. In each operation: Find the minimum value x in nums. If there are multiple occurrences of the minimum value, …
2558. Take Gifts From the Richest Pile
#Problem You are given an integer array gifts denoting the number of gifts in various piles. Every second, you do the following: Choose the pile with the maximum number of gifts. If there is more than one pile with the maximum number of …
2717. Semi-Ordered Permutation
#Problem You are given a 0-indexed permutation of n integers nums. A permutation is called semi-ordered if the first number equals 1 and the last number equals n. You can perform the below operation as many times as you want until you make …
3151. Special Array I
#Problem An array is considered special if every pair of its adjacent elements contains two numbers with different parity. You are given an array of integers nums. Return true if nums is a special array, otherwise, return false. …
1812. Determine Color of a Chessboard Square
#Problem You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference. problemReturn true if the square is white, and false if the square is black. The …
999. Available Captures for Rook
#Problem You are given an 8 x 8 matrix representing a chessboard. There is exactly one white rook represented by 'R', some number of white bishops 'B', and some number of black pawns 'p'. Empty squares are represented by '.'. A rook can …
3274. Check if Two Chessboard Squares Have the Same Color
#Problem You are given two strings, coordinate1 and coordinate2, representing the coordinates of a square on an 8 x 8 chessboard. Below is the chessboard for reference. problemReturn true if these two squares have the same color and false …
1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
#Problem Given a sentence that consists of some words separated by a single space, and a searchWord, check if searchWord is a prefix of any word in sentence. Return the index of the word in sentence (1-indexed) where searchWord is a prefix …
1346. Check If N and Its Double Exist
#Problem Given an array arr of integers, check if there exist two indices i and j such that : i != j 0 <= i, j < arr.length arr[i] == 2 * arr[j] https://leetcode.com/problems/check-if-n-and-its-double-exist/ Example 1: Input: arr = …
3232. Find if Digit Game Can Be Won
#Problem You are given an array of positive integers nums. Alice and Bob are playing a game. In the game, Alice can choose either all single-digit numbers or all double-digit numbers from nums, and the rest of the numbers are given to Bob. …