- 博客(20)
- 收藏
- 关注
原创 操作系统原理课后习题8.8
先进行判断,EXACT 4SAT属于NP。然后将3SAT归约到EXACT 4ASAT就可以证明后者的NP完全性。我们已经知道对于任意一个3SAT实例,如果某个子句中包含相同文字多次,那么可以去掉多余的,如果同时包含了某个变量的肯定及否定,那么可以将这个变量去掉,再在每个子句中添加一些没用的辅助变量,这样就可以将每个子句所包含的文字数目扩充到四个。结果3SAT实例转换成了一个EX
2017-06-20 21:06:31
698
原创 算法设计与应用基础系列19
Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.class Solution {public: bool isPalindrome(ListNode* head) { if(head==NULL||head-
2017-06-16 23:08:25
156
原创 算法设计与应用基础系列18
Best Time to Buy and Sell Stock IVSay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may compl
2017-06-15 23:51:53
176
原创 算法设计与应用基础系列17
Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.No
2017-06-15 21:07:07
184
原创 算法设计与应用基础系列16
Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @ts f
2017-06-15 18:43:28
240
原创 算法设计与应用基础系列15
Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function
2017-06-15 16:45:46
170
原创 算法设计与应用基础系列14
Min StackDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of th
2017-06-15 14:28:52
191
原创 算法设计与应用基础系列13
152Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the con
2017-06-15 01:22:56
155
原创 算法设计与应用基础系列12
Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another
2017-06-15 00:23:14
138
原创 算法设计与应用基础系列11
Word BreakGiven a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary
2017-06-14 23:30:38
170
原创 算法设计与应用基础系列10
103. Binary Tree Zigzag Level Order TraversalGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next l
2017-06-14 19:46:50
171
原创 算法设计与应用基础系列9
Combination SumGiven a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same rep
2017-06-14 14:19:18
221
原创 算法设计与应用基础系列8
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking
2017-06-14 13:47:52
195
原创 算法设计与应用基础系列7
Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Subscribe to see which companies asked this question.
2017-06-14 13:43:30
201
原创 算法设计与应用基础系列6
Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note
2017-06-10 22:42:19
198
原创 算法设计与应用基础系列5
168. Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26
2017-06-10 19:20:37
161
原创 算法设计与应用基础系列4
172. Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @t
2017-06-10 19:16:54
203
原创 算法设计与应用基础系列3
118. Pascal's TriangleGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,
2017-05-16 18:42:01
161
原创 算法设计与应用基础系列2
152. Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the
2017-05-16 18:41:09
159
原创 算法设计与应用基础系列1
Merge To Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题解:要合并两个排序好的list。先创一个新的lis
2017-05-02 15:20:48
181
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人