319 challenges in the catalogue. Browse freely; sign in to open the editor and submit.
Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth distinct element. You must find…
Sign in to solveEach row is a record of a player who logged in and played some number of games (possibly 0) using some device on a given date. Write a SQL query to report the first login date for each player. Return the result table with columns player_id…
Sign in to solveThe Tribonacci sequence T(n) is defined as follows: Given n, return the value of T(n). Example 1: Example 2: 0 <= n <= 37 The answer is guaranteed to fit within a 32-bit integer.
Sign in to solveDesign a complete AWS infrastructure using Terraform that follows production best practices. The configuration should create a VPC with public/private subnets, compute resources, and a managed database. Given infrastructure requirements,…
Sign in to solveGiven an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining…
Sign in to solveImplement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function). The algorithm for myAtoi(string s) is as follows: Read in and ignore any leading whitespace. Check if the next…
Sign in to solveYou are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the balloons. If you burst the ith balloon, you will get nums[i - 1] nums[i] nums[i +…
Sign in to solveA peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may…
Sign in to solveGiven the root of a binary search tree and a node p in it, return the in-order successor of that node in the BST. If the given node has no in-order successor, return null. The in-order successor of a node p is the node with the smallest…
Sign in to solveThere is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k],…
Sign in to solveYou are given two integer arrays nums1 and nums2 sorted in non-decreasing order and an integer k. Define a pair (u, v) which consists of one element from nums1 and one element from nums2. Return the k pairs (u1, v1), (u2, v2), ..., (uk,…
Sign in to solveGiven an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is a contiguous non-empty sequence of elements within an array. Example 1: Example 2: 1 <= nums.length <= 2 * 10^4…
Sign in to solve