自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(55)
  • 收藏
  • 关注

转载 Android基础知识每日记(持续更新)

1.Android中控件的visible属性:visible、invisible、gone  visible:设置控件可见  invisible:设置控件不可见  gone:设置控件隐藏  2017-03-0621:52:23转载于:https://www.cnblogs.com/dreamrun/p/6512220.html...

2017-03-06 21:57:00 112

转载 二叉树操作总结

  对于二叉树,有前序、中序、后序三种遍历方法,由于树的定义本身就是递归定义的,故采用递归方法实现三种遍历简洁易懂。若采用非递归访问,则需要使用栈来模拟递归的实现。三种遍历的非递归算法中,前序和后序较容易,而后序相对较难。前序遍历递归非递归树的遍历中序遍历递归非递归后序遍历递归非递归层次遍历...

2015-06-18 17:22:00 120

转载 No.223 Rectangle Area

No.223 Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure....

2015-06-12 11:07:00 96

转载 No.66 Plus One

No.66 Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.题意:...

2015-06-11 21:27:00 93

转载 No.80 Remove Duplicates from Sorted Array ||

Remove Duplicates from Sorted Array||Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=[1,1,1,2,2,3],Your functio...

2015-06-11 17:12:00 81

转载 No.27 Remove Element

No.27 Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what yo...

2015-06-11 16:38:00 66

转载 No.26 Remove Duplicates from Sorted Array

Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space f...

2015-06-11 16:16:00 58

转载 No.219 Contains Duplicate ||

No.219 Contains Duplicate ||Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the difference ...

2015-06-11 15:16:00 55

转载 No.205 Ismorphic Strings

No.205 Ismorphic StringsGiven two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a character...

2015-06-10 16:06:00 58

转载 No.217 Contains Duplicate

No.217 Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and ...

2015-06-10 15:29:00 69

转载 No.14 Longest Common Prefix

No.14 Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.求一组string的最长公共前缀想法:找到最短的那个,然后依次对比典型的字符串操作,从前向后比较即可 1 #include "std...

2015-06-10 15:09:00 66

转载 No.118 Pascal's Triangle ||

No.118 Pascal's Triangle ||Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].思路:  生成帕斯卡三角形第rowIndex+1行  粗心大意,不认真读题!!!  和生成帕斯卡三角形一样,不过...

2015-06-09 22:16:00 55

转载 No.118 Pascal's Triangle

No.118 Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...

2015-06-09 22:06:00 57

转载 No.179 Largest Number

No.179 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 is9534330.No...

2015-06-09 21:34:00 88

转载 No.56 Merge Intervals

No.56 Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].法一:直接复用之前写的insert函数,依次将区间段插入到结...

2015-06-09 11:16:00 64

转载 No.57 Insert Interval

No.57 Insert IntervalGiven a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according ...

2015-06-09 10:37:00 75

转载 No.164 Maximum Gap

No.164 Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains...

2015-06-08 17:10:00 66

转载 No.75 Sort Colors

No.75 Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we wi...

2015-06-08 16:32:00 60

转载 No.28 Implement strStr()

No.28 Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.分析:  很经典的字符串匹配问题,若可以匹配,返回模式串在字符串中首次出现的下标;...

2015-06-02 21:52:00 67

转载 No.58 Length of Last Word

No.58 Length of Last WordGiven a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, ...

2015-06-02 16:00:00 75

转载 No.67 Add Binary

No.67 Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".  与No.2 Add Two Numbers的思路非常相似,不同在:对其进行运算时,其实是要逆向相加的!!!因为边界控制的原因,可先将字...

2015-06-01 17:15:00 57

转载 No.2 Add Two Numbers

No.2 Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two number...

2015-06-01 16:36:00 43

转载 No.165 Compare Version Numbers

No.165 Compare Version NumbersCompare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1<version2return -1, otherwise return 0.You may assume that t...

2015-06-01 14:59:00 57

转载 No.68 Text Justification

No.68 Text JustificationGiven an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should pack your words...

2015-05-29 20:35:00 75

转载 No.7 Reverse Integer

No.7 Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321反转数字:将对10整除和取余的结果逆置即可难点即细节:溢出。符号疑问:溢出的,怎么处理?——提交一次出错后,知道应该是返回0为防溢出,提升类型为long lon...

2015-05-28 21:05:00 60

转载 No.166 Fraction to Recurring Decimal

No.166 Fraction to Recurring DecimalGiven two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, encl...

2015-05-28 16:41:00 80

转载 No.65 Valid Number

No.65 Valid NumberValidate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem...

2015-05-28 14:09:00 78

转载 No.135 Candy

No.135 CandyThere areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each ch...

2015-05-27 11:59:00 64

转载 No.149 Max Point on a Line

No.149 Max Point on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.尝试1:考虑不周,一条直线上的点会重复计数,但没找到解决方法【wrong】Input:[[0,0],[-1,-1],[2,2]]O...

2015-05-25 22:15:00 77

转载 No.147 Insertion Sorted List

No.147 Insertion Sorted ListSort a linked list using insertion sort.单链表排序:使用插入排序时间复杂度是排序算法的O(n^2),空间复杂度是O(1)难度:无他,把思路理顺,注意细节,并测试一下;另外头结点的巧妙应用,int最小表示方式!! 1 #include "stdafx.h" 2 #incl...

2015-05-25 20:42:00 48

转载 No.21 Merge Two Sorted List

No.21 Merge Two Sorted ListMerge 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.很简单,不多说,主要在于注意细节 1 /*...

2015-05-25 16:53:00 57

转载 No.88 Merge Sorted Array

No.88 Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great...

2015-05-25 16:35:00 53

转载 No.148 Sort List

No.148 Sort ListSort a linked list inO(nlogn) time using constant space complexity.分析:  常量空间且O(nlogn)时间复杂度,单链表适合用归并排序,双向链表适合用快速排序  有一个问题是:若算上栈空间,空间复杂度也为O(nogn)  还是对排序算法不够熟练!! ...

2015-05-25 16:22:00 50

转载 No.206 Reverse Linked List

No.206 Reverse Linked ListReverse a singly linked list.单链表带头结点【leetcode判错】: 1 #include "stdafx.h" 2 3 struct ListNode 4 { 5 int val; 6 ListNode *next; 7 ListNode(...

2015-05-25 15:37:00 76

转载 No.49 Anagrams[易位构词]

No.49 AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Tags:Hash TableString难点:  1、没有读清题意,对易位构词的理解...

2015-05-25 12:42:00 176

转载 No.50 Pow(x,n)

No.50 Pow(x,n)Implement pow(x,n).Tags MathBinary Search编写函数pow(x,n)之前想的太过简单,只是分情况讨论,然后输出结果,但没有注意到效率,并且一些违法输入不知道如何表示。注意事项:对于整数处理,比较重要的注意点在于符号和处理越界的问题一般来说...

2015-05-25 09:59:00 72

转载 No.146 LRU Cache

No.146 LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the value (will always be ...

2015-05-22 16:23:00 54

转载 No.35 Search Insert Position

No.35 Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You ma...

2015-05-22 10:42:00 76

转载 性能分析工具

  最近编程需要对性能进行优化,看到VS2012自带的性能分析工具感觉超级赞,就在网上搜了一下,看到VS2012自带的性能分析工具使用实例写的非常不错,保存一下,值得一看。转载于:https://www.cnblogs.com/dreamrun/p/4483848.html...

2015-05-07 09:06:00 43

转载 最长公共子串(LCS)

  最长公共子串是字符串匹配中一个常见问题,在此做下总结,感觉解法真的是很巧妙。  如:对于字符串“aabbaadcc”和“baadce”,矩阵中,m[i][j] = 1,表示str1[i]和str2[j]相等    a  a  b  b  a  a  d  c  c  b  0  0  1  1  0  0  0  0  0   a 1  1  0  0  1  1 ...

2015-04-03 14:58:00 62

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除