- 博客(22)
- 资源 (5)
- 收藏
- 关注
原创 leetcode8. String to Integer (atoi)
题目Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible inpu
2017-06-25 11:49:29
301
原创 leetcode 6. ZigZag Conversion
题目The 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 legibility)P A H NA P L
2017-06-24 10:44:11
235
原创 leetcode 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 answer is "b"
2017-06-23 11:41:34
246
原创 算法概论课后8.9
题目:给定一组集合{S1,S2,S3,…,Sn}和预算b,求一个集合H,其中H和所有Si相交且H的规模不超过b,前提是这个集合存在。求证该问题是NP完全问题 证明假设有一个图G(V,E),则把该图的每一条边对应一个集合Si,边上的两个点即该集合的元素,即每个集合有两个元素,如S1={v1,v2},这样一来,就能构造出|E|个集合。求图G的最小顶点覆盖问题,可以转化成求这|E|个集合
2017-06-21 11:50:06
263
原创 leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal
1.题目Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree2.思路递归.每次从后续遍历最后得到root,然后根据前序分割left tree和right tr
2017-06-03 11:46:40
190
原创 leetcode 96. Unique Binary Search Trees
1.题目Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1
2017-06-03 10:26:27
186
原创 leetcode 151. Reverse Words in a String
1.题目Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".2.思路可以考虑先对整个字符串反转,然后对其中的每个word反转,或者倒过来,先对每个word反转,然后对整个字符串反转
2017-06-01 13:48:11
243
原创 leetcode 522. Longest Uncommon Subsequence II
一。题目Given a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and this s
2017-06-01 13:12:50
671
原创 leetcode 17. Letter Combinations of a Phone Number
1.题目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:Digi
2017-05-27 21:21:33
166
原创 leetcode583. Delete Operation for Two Strings
题目Given two words word1 and word2, find the minimum number of steps required to makeword1 and word2 the same, where in each step you can delete one character in either string.Example 1:Inp
2017-05-21 13:17:03
381
原创 leetcode392. Is Subsequence
题目Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string,
2017-05-15 13:28:35
193
原创 leetcode55. Jump Game
题目Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you a
2017-05-08 17:55:55
205
原创 leetcode516. 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 palindromic subsequ
2017-04-24 20:00:32
435
原创 leetcode322. Coin Change
题目You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money
2017-04-15 17:03:07
195
原创 leetcode523. Continuous Subarray Sum
题目Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up to
2017-04-09 11:46:38
274
原创 算法:LeetCode5. Longest Palindromic Substring
题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example: Input: "babad" Output: "bab" Note: “aba” is also a valid answer.Ex
2017-04-02 16:57:15
331
原创 算法:402. Remove K Digits
题目Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 10002 and will be ≥ k.Th
2017-03-25 12:05:48
289
原创 算法:LeetCode207 Course Schedule
题目There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pai
2017-03-19 23:57:46
284
原创 算法:LeetCode240
题目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. Integers i
2017-03-05 10:18:06
348
原创 算法:LeetCode215
题目215 . Kth Largest Element in an ArrayFind 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, Given [
2017-02-26 20:36:52
329
原创 Android学习一——动态添加组件与删除,可见性设置,imagebutton简单使用
一、动态添加组件在布局为水平线性布局的情况下,添加的布局会直接加在后面,这里只是简单介绍添加布局的方法取到上下文,取到要添加组件的布局,new一个要添加的组件,设置组件相关属性,添加组件。// 动态添加textviewmcontext = this;mlinearlayout = (LinearLayout) findViewById(R.id.LinearLayout1);mte
2015-01-26 13:26:16
2429
原创 安卓文件读取
private void viewfile(String path) { StringBuffer buff = new StringBuffer(); BufferedReader reader; String str = null; str=new File(path).getName(); buff.append("name: "+str+"\n")
2014-12-01 15:01:03
408
Android开发SharedPreferences使用及调用文件管理器自定义读取文件实现
2014-12-01
android开发实现简单的音乐播放器
2014-12-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人