319 challenges in the catalogue. Browse freely; sign in to open the editor and submit.
Given a character array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete…
Sign in to solveGiven an array of distinct integers nums and a target integer target, return the number of possible combinations that add up to target. The test cases are generated so that the answer can fit in a 32-bit integer. Note that different…
Sign in to solveCross-Site Scripting (XSS) is a type of security vulnerability where an attacker injects malicious scripts into content from otherwise trusted websites. One of the primary ways to prevent XSS is to sanitize user-provided data before…
Sign in to solveYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one.…
Sign in to solveYou are given an array of k arrays of integers, where each array is sorted in ascending order. Merge all the arrays into one sorted array and return it. Example 1: Example 2: Example 3: k == arrays.length 0 <= k <= 10^4 0 <=…
Sign in to solveImplement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val)…
Sign in to solveWrite a SQL query to report the second highest salary from the Employee table. If there is no second highest salary, the query should report null. The query result format is in the following example. Table: Employee | Column Name | Type |…
Sign in to solveGiven two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.…
Sign in to solveImplement a virtual DOM diffing algorithm that compares two virtual DOM trees and produces a minimal set of patches (operations) to transform the old tree into the new tree. This is the core algorithm behind frameworks like React — it…
Sign in to solveThe 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…
Sign in to solveDesign and implement a rate limiting system that controls the rate of API requests from clients. The system should support multiple rate limiting algorithms, per-client and per-endpoint configuration, and work correctly in a distributed…
Sign in to solveYou are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all…
Sign in to solve