319 challenges in the catalogue. Browse freely; sign in to open the editor and submit.
Implement a curry function that transforms a function so it can be called with its arguments one at a time (or in groups). A curried function keeps returning new functions until all expected arguments have been provided, at which point it…
Sign in to solveDesign a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest class: constructor(k: number, nums: number[]) Initializes the…
Sign in to solveGiven a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Input: s = "aab" Output: [["a","a","b"],["aa","b"]] Input: s = "a" Output: [["a"]] 1 <= s.length <=…
Sign in to solveGiven the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a binary tree tree is a tree that consists of a node in…
Sign in to solveSQL injection is one of the most common and dangerous web vulnerabilities (OWASP Top 10 #3). Your task is to identify vulnerable SQL queries and rewrite them using secure patterns. Given vulnerable SQL query patterns that concatenate user…
Sign in to solveGiven an array of meeting time intervals intervals where intervals[i] = [start_i, end_i], return the minimum number of conference rooms required. Example 1: Example 2: Example 3: 1 <= intervals.length <= 10^4 0 <= start_i < end_i <= 10^6
Sign in to solveThere is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any…
Sign in to solveid is the primary key column. Each row contains an email. Emails will not contain uppercase letters. Write a SQL query to report all duplicate emails. A duplicate email is one that appears more than once in the table. Return the result…
Sign in to solvepid is the primary key. tiv_2015 is the total investment value in 2015. tiv_2016 is the total investment value in 2016. lat and lon are the latitude and longitude of the policyholder's city. Pairs of (lat, lon) are guaranteed to be unique.…
Sign in to solveDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: MinStack() initializes the stack object. push(val) pushes the element val onto the stack. pop() removes the…
Sign in to solveGiven an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should…
Sign in to solveYou have some number of sticks with positive integer lengths. These lengths are given as an array sticks, where sticks[i] is the length of the $i^{th}$ stick. You can connect any two sticks of lengths x and y into one stick by paying a…
Sign in to solve