- 博客(16)
- 收藏
- 关注
转载 [Leetcode] Single Number III
问题描述: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:
2016-04-06 15:50:16 319
转载 [Leetcode] Ugly Number II
题目描述:Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the
2016-04-06 15:20:46 324
转载 [Leetcode] Sliding Window Maximum 滑动窗口最大值
Sliding Window MaximumGiven an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each
2016-04-05 21:00:18 418
转载 [LeetCode] Gas Station,转化为求最大序列的解法,和更简单简单的Jump解法。
LeetCode上 Gas Station是比较经典的一题,它的魅力在于算法足够优秀的情况下,代码可以简化到非常简洁的程度。原题如下Gas StationThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a
2016-03-11 18:08:29 333
转载 Mysql常用命令
Mysql常用命令详解Mysql安装目录数据库目录/var/lib/mysql/配置文件/usr/share/mysql(mysql.server命令及配置文件)相关命令/usr/bin(mysqladmin mysqldump等命令)启动脚本/etc/init.d/mysql(启动脚本文件mysql的目录)系统管理连接MySQL格式: mysq
2016-01-06 15:17:02 242
原创 leetcode Unique Binary Search Trees II 答案详解
Given n, generate all structurally uniqueBST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1
2015-12-17 21:17:03 376
原创 Unique Binary Search Trees leetcode答案解析
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. 给一个整数n,求以1~n共能组成多少种二叉搜索树动态规划题,创建一数组ans
2015-12-17 21:06:15 349
转载 leetcode 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
2015-12-07 16:01:58 244
原创 leetcode 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"
2015-12-01 21:11:12 418
原创 leetcode Search a 2D Matrix
典型的二叉搜索问题先找到在第几行再找第几个class Solution {public: bool searchMatrix(vector >& matrix, int target) { int fir=0,las=matrix.size()-1,le=0,ri=matrix[0].size()-1; while(fir
2015-11-29 13:00:25 227
原创 leetcode Set Matrix Zeroes 代码解析
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. 开辟一个长为m+n的数组标记每一行每一列是否出现0.使用O(1)空间方法:使用原数组第一行和第一列记录0 的位置信息将 0 映射到第一行和第一列,使用col 和row 分别记录第一
2015-11-29 12:47:22 193
原创 leetcode Editdistance
leetcode Edit Distance 答案解析 动态规划 Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:
2015-11-28 20:39:28 254
转载 K个值求和计算
转自烟客旅人 sigmainfy — tech-wonderland.net:http://tech-wonderland.net/blog/summary-of-ksum-problems.htmlSummary for LeetCode 2Sum, 3Sum, 4Sum, K Sum OverviewI summarize vario
2015-10-11 20:24:09 1818
转载 C++ 中STL map 详解
http://www.kuqin.com/cpluspluslib/20071231/3265.html这篇文章对map 的用法概括的比较详细。 Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。这里说
2015-10-03 16:18:27 355
转载 python实现读取命令行参数
这篇文章主要介绍了python实现读取命令行参数的方法,涉及Python中sys模块的相关使用技巧,需要的朋友可以参考下本文实例讲述了python读取命令行参数的方法。分享给大家供大家参考。具体分析如下:如果想对python脚本传参数,python中对应的argc, argv(c语言的命令行参数)是什么呢?需要模块:sys参数个数:len(sys.a
2015-09-30 20:49:26 549
转载 eclipse中常用的快捷键
(注:红色标出来的是经常使用到的快捷键,磨刀不误砍柴工啊。。。)Ctrl+1 快速修复(最经典的快捷键,就不用多说了)Ctrl+Shift+O 自动导入所需要的包(这个用的次数也相当多)Ctrl+D: 删除当前行 Ctrl+Alt+↓ 复制当前行到下一行(复制增加)Ctrl+Alt+↑ 复制当前行到上一行(复制增加)Alt+↓ 当前行和下面一行交互位置(特别实用,可以省去先
2015-06-05 13:03:00 239
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人