319 challenges in the catalogue. Browse freely; sign in to open the editor and submit.
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets. Example 1:…
Sign in to solveDesign a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: constructor() Initializes the object. addWord(word) Adds word to the data structure, it…
Sign in to solveDesign a highly scalable and reliable notification system that can deliver messages through various channels such as Push Notifications (iOS/Android), SMS, and Email. Multi-Channel Support: Support Apple Push Notification service (APNs),…
Sign in to solveGiven an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. You must…
Sign in to solveThe Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, Given n, calculate F(n). Example 1: Example 2: Example…
Sign in to solveYou are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete at most two transactions. Note: You may not engage in multiple transactions…
Sign in to solveGiven a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Input: pattern = "abba", s = "dog cat cat dog"…
Sign in to solveBuild a push notification processing system that handles notification delivery logic including channel filtering, quiet hours, and priority-based overrides. Check if notifications are globally enabled Check if the notification channel is…
Sign in to solveImplement your own version of Array.prototype.map. The function takes an array and a callback, and returns a new array where each element is the result of calling the callback on the corresponding element of the input array. arr — The…
Sign in to solveImplement an EventEmitter class that supports subscribing to events, emitting events, and unsubscribing. This is a fundamental pattern used in Node.js, browser APIs, and many frameworks. on(event, callback) — Subscribe a callback to an…
Sign in to solveGiven the root of a binary tree, flatten the tree into a "linked list": The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. The…
Sign in to solveImplement pow(x, n), which calculates x raised to the power n (i.e., x^n). Input: x = 2.00000, n = 10 Output: 1024.00000 Input: x = 2.10000, n = 3 Output: 9.26100 Input: x = 2.00000, n = -2 Output: 0.25000 Explanation: 2^-2 = 1/2^2 = 1/4 =…
Sign in to solve