https://leetcode.com/problems/minimum-path-sum/ 64. Minimum Path Sum Total Accepted: 91005 Total Submissions: 247256 Difficulty: Medium Contributors: Admin Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any …
Author Archives: czxttkl
Leetcode 88: Merge Sorted Array
88. Merge Sorted Array Total Accepted: 129487 Total Submissions: 416385 Difficulty: Easy Contributors: Admin Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The …
Leetcode 77: Combinations
77. Combinations Total Accepted: 96007 Total Submissions: 258054 Difficulty: Medium Contributors: Admin Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Code class …
Leetsql 196: Delete Duplicate Emails
196. Delete Duplicate Emails Total Accepted: 18532 Total Submissions: 97924 Difficulty: Easy Contributors: Admin Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. +—-+——————+ | Id | Email | +—-+——————+ | 1 | john@example.com | | 2 | bob@example.com | …
Leetcode 254: Factor Combinations
254. Factor Combinations Total Accepted: 16019 Total Submissions: 40853 Difficulty: Medium Contributors: Admin Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possible combinations of its factors. Note: You may assume …
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 …
Continue reading “Leetcode 211: Add and Search Word – Data structure design”
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 …
Continue reading “Leetcode 181: Employees Earning More Than Their Managers”