- 博客(13)
- 收藏
- 关注
原创 期末算法作业
题目:在精确的4SAT(EXACT 4SAT)问题中,输入为一组子句,每个子句都是恰好4个文字的析取,且每个变量最多在每个子句中出现一次。目标是求它的满足赋值(如果该赋值存在)。证明精确的4SAT问题是NP-完全问题。解答:要证明EXACT 4SAT 属于 NP问题,因为EXACT 4SAT同SAT问题类似,显然给出一个解都可以在多项式时间内验证,所以EXA
2017-07-09 20:13:57 243
原创 第十七周算法题
题目详情:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You
2017-06-18 21:39:41 204
原创 第十六周算法题
336. Palindrome PairsDescriptionHintsSubmissionsSolutionsTotal Accepted: 24269Total Submissions: 94125Difficulty: HardContributor: LeetCodeGiven a list of uni
2017-06-11 23:30:20 243
原创 第十五周算法题
题目详情Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the
2017-06-04 18:44:06 244
原创 第十四周算法题
题目详情:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring
2017-05-27 22:59:59 231
原创 第十三周算法
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant
2017-05-21 22:13:39 193
原创 第九周算法题
题目链接:点击打开链接题目详情: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.题目解答:def threeSum(s
2017-04-23 11:35:18 176
原创 第七周算法题
题目来源:点击打开链接题目详情:You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the
2017-04-09 23:15:51 247
原创 第六周算法题
题目来源 点击打开链接题目详情 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.题目解答
2017-03-31 15:05:27 109
原创 第四周算法题
题目来源 点击打开链接题目详情 Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Co
2017-03-19 20:21:23 184
原创 第三周作业
题目来源 点击打开链接题目详情 You need to find the largest value in each row of a binary tree.题目思路 构建结构向量存放在每层得到的最大值,通过深度优先搜索在每层找到一个值,再进行迭代在每层找出一个值和向量中已有的值比较,直到结束得到最终结果。代码段 class Solution {privat
2017-03-12 12:34:35 127
原创 C++算法题_第二周
题目来源 点击打开链接题目详情 Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,
2017-03-04 21:04:21 553
原创 C++算法题_第一周
题目来源 点击打开链接题目详情 Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice
2017-02-25 16:37:32 332
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人