- 博客(15)
- 收藏
- 关注
原创 8.15 最大公共子图
题目描述:证明如下问题是 NP-完全的:输入:两个图 G1=(V1,E1)和 G2=(V2,E2); 预算b。输出:两个节点集合V1’是V1的子集,V2'是V2子集,它们被移除后,将在两图中分别留下至少b个节点,且图的剩余部分完全一样。题目解答:分析: 我们需要找到一个NP-完全问题规约到该问题上,从而证明出该问题是NP-完全的。我们选择团问题规约到该问
2017-07-11 20:28:53 999
原创 22. Generate Parentheses题解
22. Generate ParenthesesDescriptionHintsSubmissionsSolutionsDiscuss Editorial SolutionPick OneGiven n pairs of parentheses, write a function to generate
2017-06-25 22:19:58 186
原创 24. Swap Nodes in Pairs题解
DescriptionHintsSubmissionsSolutionsTotal Accepted: 162390Total Submissions: 427247Difficulty: MediumContributor: LeetCodeGiven a linked list, swap every two adjacent nod
2017-06-18 23:04:13 196
原创 20. Valid Parentheses题解
DescriptionHintsSubmissionsSolutionsTotal Accepted: 202731Total Submissions: 611689Difficulty: EasyContributor: LeetCodeGiven a string containing just the characters '(',
2017-06-18 22:09:44 182
原创 17. Letter Combinations of a Phone Number题解
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st
2017-06-18 22:03:17 207
原创 19. Remove Nth Node From End of List题解
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2017-06-18 20:44:34 141
原创 15. 3Sum题解
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain
2017-06-18 20:34:31 155
原创 11. Container With Most Water题解
DescriptionHintsSubmissionsSolutionsTotal Accepted: 132924Total Submissions: 365451Difficulty: MediumContributor: LeetCodeGiven n non-negative integers a1, a2, ..., an,
2017-06-18 20:25:53 144
原创 3. Longest Substring Without Repeating Characters题解
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the an
2017-06-11 22:18:30 128
原创 5. Longest Palindromic Substring 题解
题目:Total Accepted: 202411Total Submissions: 805973Difficulty: MediumContributor: LeetCodeGiven a string s, find the longest palindromic substring in s. You may assume that the maximum
2017-06-11 21:51:51 220
原创 Combine Two Tables题解
1.题目分析:题目有Person表和Address表两个数据表。Person表的主键是PersonId,Address表的主键是AddressId,通过PersonId与Person表关联。此题需要通过写SQL查询,对于Person表中所有人,取出FirstName, LastName, City, State属性,不管地址信息有没有。这道题中,Person表是主表,Address表是从表,采
2017-06-04 21:17:53 192
原创 181. Employees Earning More Than Their Managers解题
题目分析:雇员表有所有员工的信息。所有员工和经理都有ID。给定雇员表,通过编写SQL找到工资比经理多的员工的姓名。上表中,只有Joe工资比经理多。此题采用自连接SQL语句:SELECT a.NAME FROM Employee a, Employee b WHERE a.ManagerId = b.Id AND a.Salary > b.Salary;
2017-06-04 21:09:37 209
原创 183.Customers Who Never Order题解
题目分析:一个包含Customers的顾客表和Orders的订单表,两个表。通过SQL找到从没有过订单的顾客。可以用NOT IN,NOT EXISTS。 SQL语句:1.使用NOT IN(Accepted 777ms): SELECT Name FROM Customers c WHERE c.Id NOT IN (SELECT CustomerId FROM Orders o)
2017-06-04 20:45:31 175
原创 .ZigZag Conversion题目分析
题目6.ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legi
2017-05-21 23:27:43 199
原创 Single Element in a Sorted Array
题目540.Single Element in a Sorted ArrayDescriptionHintsSubmissionsSolutionsTotal Accepted: 4418Total Submissions: 8253Difficulty: MediumContributors:rajaditya
2017-04-16 21:37:58 297
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人