Leetsql 182: Duplicate Emails

182. Duplicate Emails  Total Accepted: 27110 Total Submissions: 73222 Difficulty: Easy Contributors: Admin Write a SQL query to find all duplicate emails in a table named Person. +—-+———+ | Id | Email | +—-+———+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +—-+———+ For example, your query should …

Leetcode 221: Maximal Square

https://leetcode.com/problems/maximal-square/ 221. Maximal Square  Total Accepted: 44584 Total Submissions: 169331 Difficulty: Medium Contributors: Admin Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 …

Leetcode 211: Add and Search Word – Data structure design

211. Add and Search Word – Data structure design  Total Accepted: 37880 Total Submissions: 188966 Difficulty: Medium Contributors: Admin Design a data structure that supports the following two operations: void addWord(word) bool search(word) search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can …

Leetcode 252: Meeting Rooms

https://leetcode.com/problems/meeting-rooms/ 252. Meeting Rooms Total Accepted: 19160 Total Submissions: 43021 Difficulty: Easy Contributors: Admin Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],…] (si < ei), determine if a person could attend all meetings. For example,Given [[0, 30],[5, 10],[15, 20]],return false.     Code # Definition for an interval. # …

Leetcode 181: Employees Earning More Than Their Managers

https://leetcode.com/problems/employees-earning-more-than-their-managers/ 181. Employees Earning More Than Their Managers Total Accepted: 27138 Total Submissions: 76486 Difficulty: Easy Contributors: Admin The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +—-+——-+——–+———–+ | Id | Name | Salary | ManagerId | +—-+——-+——–+———–+ | 1 …

Leetcode 178: Rank Score

https://leetcode.com/problems/rank-scores/ 178. Rank Scores  Total Accepted: 13824 Total Submissions: 58154 Difficulty: Medium Contributors: Admin Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. In other words, there …

Leetcode 3466: Moving Average from Data Stream

346. Moving Average from Data Stream Total Accepted: 11701 Total Submissions: 20717 Difficulty: Easy Contributors: Admin Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, MovingAverage m = new MovingAverage(3); m.next(1) = 1 m.next(10) = (1 + 10) / 2 m.next(3) = …

Leetcode 163: Missing Ranges

163. Missing Ranges Total Accepted: 19465 Total Submissions: 66232 Difficulty: Medium Contributors: Admin Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges. For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4->49", "51->74", "76->99"].   …

Leetcode 388: Longest Absolute File Path

388. Longest Absolute File Path Total Accepted: 11837 Total Submissions: 35565 Difficulty: Medium Contributors: Admin Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents: dir subdir1 subdir2 file.ext The directory dir contains an empty sub-directory subdir1 and a sub-directory subdir2 containing a file file.ext. The string "dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext" …