算法练习
zhanhailiu
这个作者很懒,什么都没留下…
展开
-
1.1 Array 495.Teemo Attacking
难度等级:Medium题目:In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe原创 2017-02-21 20:36:32 · 289 阅读 · 0 评论 -
467. Unique Substrings in Wraparound String
题目:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".原创 2017-06-06 16:43:53 · 227 阅读 · 0 评论 -
474. Ones and Zeroes
题目:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator of m 0s and n 1s respectively原创 2017-05-21 22:30:52 · 197 阅读 · 0 评论 -
486. Predict the Winner
题目:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a playe原创 2017-05-21 17:07:23 · 240 阅读 · 0 评论 -
494. Target Sum
题目:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol.原创 2017-05-15 23:19:43 · 173 阅读 · 0 评论 -
532. K-diff Pairs in an Array
题目:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both原创 2017-04-22 17:16:18 · 182 阅读 · 0 评论 -
516. Longest Palindromic Subsequence
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.Example 1:Input:"bbbab"Output:4One possible longest palind原创 2017-04-30 13:49:03 · 156 阅读 · 0 评论 -
240. Search a 2D Matrix II
题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right原创 2017-04-11 20:43:50 · 350 阅读 · 0 评论 -
241. Different Ways to Add Parentheses
题目:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Exam原创 2017-04-11 17:20:46 · 198 阅读 · 0 评论 -
282. Expression Add Operators
题目:Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or *between the digits so they evaluate to the target原创 2017-04-09 17:23:59 · 180 阅读 · 0 评论 -
514. Freedom Trail (Divide and Conquer)
题目:In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring", and use the dial to spell a specific keyword in order to open原创 2017-03-12 23:24:09 · 286 阅读 · 0 评论 -
312. Burst Balloons (Divide and Conquer)
Total Accepted: 23535Total Submissions: 56077Difficulty: HardContributors: Admin题目:Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array n原创 2017-03-28 21:11:45 · 216 阅读 · 0 评论 -
315. Count of Smaller Numbers After Self ( Divide and Conquer)
题目:You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].原创 2017-03-21 19:00:28 · 190 阅读 · 0 评论 -
327. Count of Range Sum(Divide and Conquer)
题目:Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.Range sum S(i, j) is defined as the sum of the elements in nums between indices i and j原创 2017-03-19 21:34:11 · 280 阅读 · 0 评论 -
2.1 493. Reverse Pairs (Divide and Conquer)
题目:Given an array nums, we call (i, j) an important reverse pair if i and nums[i] > 2*nums[j].You need to return the number of important reverse pairs in the given array.Example1:原创 2017-03-04 12:49:11 · 269 阅读 · 0 评论 -
Np 完全问题 8.3
思路:我们应该验证是否在多项式时间内可以解决stingy sat的问题,能否得出正确的解:将问题归到stingy sat,假设一个stingy sat 的实例(f,k),一组赋值m。(a)令m为f的解,那么最多有k个为真的变量,m对(f,k)的值亦为真,则m为(f,k)的解。(b)令m为(f,k)的解,可知m为f的解。综上,stingy sat为一个Np完全问题。原创 2017-07-14 21:32:01 · 202 阅读 · 0 评论