319 challenges in the catalogue. Browse freely; sign in to open the editor and submit.
Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: 1 <= nums.length <= 10^5 -2^31 <= nums[i] <= 2^31 - 1 0 <= k <= 10^5 Try to come up with as many solutions as you can.…
Sign in to solveGiven two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string generated from the original string with some characters (can…
Sign in to solveGiven a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. The deletion can be divided into two stages: Search for the node to remove. If the…
Sign in to solveImplement a flatten function that takes a nested array and returns a new array with the nesting removed. An optional depth parameter controls how many levels of nesting to flatten. If no depth is given, flatten completely. This is a common…
Sign in to solveThere are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi to city toi with cost pricei. You are also given three integers…
Sign in to solveWrite a SQL query to: Find the name of the user who has rated the greatest number of movies. In case of a tie, return the lexicographically smaller user name. Find the movie name with the highest average rating in February 2020. In case of…
Sign in to solveDesign a real-time search autocomplete system similar to Google Search or Amazon's search bar. When a user types a prefix, the system should suggest the top $K$ (e.g., 5-10) most relevant and popular completed queries. Top K Suggestions:…
Sign in to solveYou are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times. Return the length of the longest substring…
Sign in to solveYou are given a list of airline tickets where tickets[i] = [from_i, to_i] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from…
Sign in to solveGiven an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve the problem without modifying the array…
Sign in to solveGiven the root of a binary tree, return the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels. The width of one level is defined as the length between the end-nodes (the leftmost and…
Sign in to solveImplement a debounce function that delays invoking the provided function until after delay milliseconds have elapsed since the last time the debounced function was invoked. Debouncing is a common technique used in web development to limit…
Sign in to solve