上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 19 下一页
摘要: Write a function to find the longest common prefix string amongst an array of strings. 题意:找出所有字符串共同的最长前缀; 思路:因为是共同前缀,所以,求得第一个字符串和第二个字符的共同前缀以后,以这个前缀和后面 阅读全文
posted @ 2017-07-18 15:22 王大咩的图书馆 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here a 阅读全文
posted @ 2017-07-18 10:46 王大咩的图书馆 阅读(340) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文
posted @ 2017-07-18 10:10 王大咩的图书馆 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文
posted @ 2017-07-18 09:35 王大咩的图书馆 阅读(211) 评论(0) 推荐(1) 编辑
摘要: 一、数据结构的栈和堆 首先在数据结构上要知道堆栈,尽管我们这么称呼它,但实际上堆栈是两种数据结构:堆和栈。堆和栈都是一种数据项按序排列的数据结构。 1)栈就像装数据的桶或箱子 我们先从大家比较熟悉的栈说起吧,它是一种具有后进先出性质的数据结构,也就是说后存放的先取,先存放的后取。这就如同我们要取出放 阅读全文
posted @ 2017-07-18 00:51 王大咩的图书馆 阅读(433) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort. 题意:使用插入排序排链表。 思路:所谓的插入排序法,可以理解为,从原链表中取结点,每次都从新的链表的开头开始遍历比较,在新链表中找到不小于当前节点的位置,然后将当前节点插入进去,依次重复这种过程,时间复杂度为O(n^2 阅读全文
posted @ 2017-07-17 18:15 王大咩的图书馆 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2017-07-17 16:48 王大咩的图书馆 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are+,-,*,/. Each operand may be an integer or another expre 阅读全文
posted @ 2017-07-16 21:52 王大咩的图书馆 阅读(183) 评论(0) 推荐(1) 编辑
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2017-07-16 20:19 王大咩的图书馆 阅读(171) 评论(0) 推荐(1) 编辑
摘要: Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring. For"(()", the longes 阅读全文
posted @ 2017-07-16 16:12 王大咩的图书馆 阅读(327) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid. The brackets must close in the correct 阅读全文
posted @ 2017-07-16 10:36 王大咩的图书馆 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 题意:求全由1组成的最大矩形面积。 思路:这题感觉是larges 阅读全文
posted @ 2017-07-15 16:12 王大咩的图书馆 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist 阅读全文
posted @ 2017-07-15 15:40 王大咩的图书馆 阅读(3572) 评论(2) 推荐(1) 编辑
摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S ="ADOBECODE 阅读全文
posted @ 2017-07-14 21:05 王大咩的图书馆 阅读(300) 评论(0) 推荐(1) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array[−2,1,−3,4,−1,2,1 阅读全文
posted @ 2017-07-14 16:11 王大咩的图书馆 阅读(386) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 19 下一页