全站内容
hard
730. Count Different Palindromic Subsequences
#Problem Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 10⁹ + 7. A subsequence of a string is obtained by deleting zero or more characters from …
913. Cat and Mouse
#Problem A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph. The mouse starts at node 1 and goes …
321. Create Maximum Number
#Problem You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digits of two numbers. You are also given an integer k. Create the maximum number of length k <= m + n from digits of …
843. Guess the Word
#Problem You are given an array of unique strings words where words[i] is six letters long. One word of words was chosen as a secret word. You are also given the helper object Master. You may call Master.guess(word) where word is a …
1639. Number of Ways to Form a Target String Given a Dictionary
#Problem You are given a list of strings of the same length words and a string target. Your task is to form target using the given words under the following rules: target should be formed from left to right. To form the iᵗʰ character …
1206. Design Skiplist
#Problem Design a Skiplist without using any built-in libraries. A skiplist is a data structure that takes O(log(n)) time to add, erase and search. Comparing with treap and red-black tree which has the same function and performance, the …
1250. Check If It Is a Good Array
#Problem Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. The array is said to be good if you can obtain a sum of 1 from the array by any …
1298. Maximum Candies You Can Get from Boxes
#Problem You have n boxes labeled from 0 to n - 1. You are given four arrays: status, candies, keys, and containedBoxes where: status[i] is 1 if the iᵗʰ box is open and 0 if the iᵗʰ box is closed, candies[i] is the number of candies in the …
689. Maximum Sum of 3 Non-Overlapping Subarrays
#Problem Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them. Return the result as a list of indices representing the starting position of each interval …
2493. Divide Nodes Into the Maximum Number of Groups
#Problem You are given a positive integer n representing the number of nodes in an undirected graph. The nodes are labeled from 1 to n. You are also given a 2D integer array edges, where edges[i] = [aᵢ, bᵢ] indicates that there is a …