`
huntfor
  • 浏览: 195309 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
Multiply Strings Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.  让大家见识见识第一次的算法提交之后有多坑。 最后一个case没过,我忍了,但是尼玛这个结果是什么情况,这么长的结果,就一位错了,debug都不能啊魂淡,你要闹哪样啊小婊砸。 然后那晚上就抓狂了,放了一段时间之后,再做,借鉴别人的思路,有了以 ...
Largest Rectangle in Histogram   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 histogram.Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].The largest rectangle is show ...
不得不说,这个算法还是不错的,就是Collections.sort()方法不会用。。。   新博文地址:[leetcode]Merge Intervals   Merge Intervals Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10] ...
真是蛋疼啊,这么长时间不碰工程上的东西,手生的不得了,配置个环境浪费了半天时间。拙计。 下午下载了mysql,现在官网上都是免安装的?看着教程配置完之后,真是手贱啊,把权限修改了,结果自己本地都进不去了,只好又把mysql服务卸载了,不过正因为如此学到了SC命令的一些运用。 具体mysql免安装版的配置如下: 写道 解压到自定义目录,我这里演示的是D:\wamp\mysql\复制根目录下的my-default.ini,改名为my.ini,my.ini用下面内容替换#以下是复制内容,这行可不复制[client]port=3306default-character-set=utf8#客户端 ...
新博文地址:[leetcode]Spiral Matrix Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]  这道题是《剑指offer》上的例题,上面的解法很简单,但是我没用,我的算法更简单,而且也是O(m*n)的复杂度,但是需要O(m*n)的 ...
新博文地址:[leetcode]4Sum 4Sum Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie, a ≤ ...
新博客地址: [leetcode]Regular Expression Matching Regular Expression Matching Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partia ...
这道题。。。。简直了。。。 新博文地址:[leetcode]Insert Interval  Insert Interval Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals [1,3],[6,9], ins ...
新博文地址:[leetcode]Substring with Concatenation of All Words Substring with Concatenation of All Words You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without ...
Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may not engage in multiple transactions at the same time (ie, you must sell t ...
新博文地址:[leetcode]Gas Station Gas Station There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty ta ...
新博文地址: [leetcode]Median of Two Sorted Arrays Median of Two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 这道题想了很长时间,不会做,看到这位大神的通用求法,瞬间跪了。 算法思想: Assume that the nu ...
新博文地址:[leetcode]Minimum Window Substring   Minimum Window Substring 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 = "ADOBECODEBANC"T = "ABC"Minimum window is "BANC".Note:If t ...
新博文地址:[leetcode]First Missing Positive First Missing Positive Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant space.  这是一道好题哇,我实在没想到用O(1)的空间做解,用的O(n),后来看了网 ...
新博文地址:[leetcode]String to Integer (atoi) 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 input cas ...
Global site tag (gtag.js) - Google Analytics