Quantcast
Channel: 书影 - Entries for the tag leetcode
Browsing all 559 articles
Browse latest View live

[LeetCode]Maximum Vacation Days

题目大意:LeetCode 568. Maximum Vacation DaysLeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jack a dull...

View Article


LeetCode Weekly Contest 30解题报告

LeetCode Weekly Contest 30是LeetCode举办的第三十五场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-30/题解列表:LeetCode 566. Reshape the MatrixLeetCode 560. Subarray Sum Equals...

View Article


[LeetCode]Find Median Given Frequency of Numbers

题目描述:LeetCode 571. Find Median Given Frequency of NumbersThe Numbers table keeps the value of number and its frequency. +----------+-------------+ | Number | Frequency | +----------+-------------| | 0...

View Article

[LeetCode]Employee Bonus

题目描述:LeetCode 577. Employee BonusSelect all employee's name and bonus whose bonus is < 1000.Table:Employee +-------+--------+-----------+--------+ | empId | name | supervisor| salary |...

View Article

[LeetCode]Distribute Candies

题目描述:LeetCode 575. Distribute CandiesGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the...

View Article


[LeetCode]Subtree of Another Tree

题目描述:LeetCode 572. Subtree of Another TreeGiven two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree...

View Article

Image may be NSFW.
Clik here to view.

[LeetCode]Squirrel Simulation

题目描述:LeetCode 573. Squirrel SimulationThere's a tree, a squirrel, and several nuts. Positions are represented by the cells in a 2D grid. Your goal is to find the minimal distance for the squirrel to...

View Article

Image may be NSFW.
Clik here to view.

[LeetCode]Out of Boundary Paths

题目描述:LeetCode 576. Out of Boundary PathsThere is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary in four...

View Article


LeetCode Weekly Contest 31解题报告

LeetCode Weekly Contest 31是LeetCode举办的第三十六场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-31/题解列表:LeetCode 575. Distribute CandiesLeetCode 572. Subtree of Another...

View Article


[LeetCode]Get Highest Answer Rate Question

题目描述:LeetCode 578. Get Highest Answer Rate QuestionGet the highest answer rate question from a table survey_log with these columns: uid, action, question_id, answer_id, q_num, timestamp.uid means user...

View Article

[LeetCode]Count Student Number in Departments

题目描述:LeetCode 580. Count Student Number in DepartmentsA university uses 2 data tables, student and department, to store data about its students and the departments associated with each major.Write a...

View Article

[LeetCode]Shortest Unsorted Continuous Subarray

题目描述:LeetCode 581. Shortest Unsorted Continuous SubarrayGiven an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array...

View Article

[LeetCode]Kill Process

题目描述:LeetCode 582. Kill ProcessGiven n processes, each process has a unique PID (process id) and its PPID (parent process id).Each process only has one parent process, but may have one or more children...

View Article


[LeetCode]Delete Operation for Two Strings

题目描述:LeetCode 583. Delete Operation for Two StringsGiven two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one...

View Article

Image may be NSFW.
Clik here to view.

[LeetCode]Erect the Fence

题目描述:LeetCode 587. Erect the FenceThere are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the minimum length...

View Article


LeetCode Weekly Contest 32解题报告

LeetCode Weekly Contest 32是LeetCode举办的第三十七场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-32/题解列表:LeetCode 581. Shortest Unsorted Continuous SubarrayLeetCode 582. Kill...

View Article

[LeetCode]Longest Harmonious Subsequence

题目描述:LeetCode 594. Longest Harmonious SubsequenceWe define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.Now, given an integer array,...

View Article


[LeetCode]Valid Square

题目描述:LeetCode 593. Valid SquareGiven the coordinates of four points in 2D space, return whether the four points could construct a square.The coordinate (x,y) of a point is represented by an integer...

View Article

[LeetCode]Fraction Addition and Subtraction

题目描述:LeetCode 592. Fraction Addition and SubtractionGiven a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final...

View Article

Image may be NSFW.
Clik here to view.

[LeetCode]Design In-Memory File System

题目描述:LeetCode 588. Design In-Memory File SystemDesign an in-memory file system to simulate the following functions:ls: Given a path in string format. If it is a file path, return a list that only...

View Article
Browsing all 559 articles
Browse latest View live