- 博客(9)
- 收藏
- 关注
原创 算法概论第八章课后习题
算法概论第八章课后习题8.3 吝啬SAT问题是这样的:给定一组子句(每个子句都是其中文字的析取)和整数k,求一个最多有k各变量为true的满足赋值 —— 如果该赋值存在。证明吝啬SAT是NP完全问题。证:①证明吝啬SAT是NP问题。对于一组待判断的赋值,将其分别代入子句中,即可验证该赋值是否是有效的。因此吝啬SAT可以在多项式时间内被验证,所以是NP问题。②证明吝啬SA
2017-01-15 16:58:52
575
原创 LeetCode307 Range Sum Query-Mutable
Given an integer array nums, find the sum of the elements between indicesi and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at indexi to val.Example:
2016-10-26 00:29:00
198
原创 LeetCode98 Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key
2016-10-25 13:25:47
190
原创 LeetCode92 Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the
2016-10-25 10:35:34
159
原创 LeetCode 220 Contains Duplicate III
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] andnums[j] is at most t and the difference between i a
2016-10-24 16:59:28
174
原创 LeetCode 342 Power of Four
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example:Given num = 16, return true. Given num = 5, return false. Follow up: Could you solve it without
2016-10-12 12:49:07
174
原创 LeetCode 318 Maximum Product of Word Lengths
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case
2016-09-10 19:59:02
204
原创 LeetCode 127 Word Ladder
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence frombeginWord to endWord, such that: Only one letter can be changed at
2016-09-07 21:10:43
167
原创 Leetcode 389 Find the Difference
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was
2016-09-01 08:55:45
203
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人