自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

给永远比拿愉快

操蛋的人生操蛋地过

  • 博客(52)
  • 资源 (19)
  • 论坛 (1)
  • 收藏
  • 关注

原创 Leetcode: Evaluate Reverse Polish Notation

题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:[“2”, “1”, “+”, “3”, “

2015-03-31 22:34:04 656

原创 Leetcode: Reverse Words in a String

题目: Given an input string, reverse the string word by word.For example, Given s = “the sky is blue”, return “blue is sky the”. 思路一: 先休整下给定的字符串,去掉其中的多于一个的空格,就是使所有单词之间的空格都变成一个,然后去掉最后面的空格,给最前面加一个空格。这

2015-03-31 14:50:39 954

原创 Leetcode: Maximum Product Subarray

题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest

2015-03-30 22:15:00 980

原创 Leetcode: Maximum Subarray

题目: 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,−5,4], the contiguous subarray [4,−1,2,1] h

2015-03-30 21:53:36 912

转载 五大常用算法之二:动态规划算法

一、基本概念    动态规划过程是:每次决策依赖于当前状态,又随即引起状态的转移。一个决策序列就是在变化的状态中产生出来的,所以,这种多阶段最优化决策解决问题的过程就称为动态规划。二、基本思想与策略    基本思想与分治法类似,也是将待求解的问题分解为若干个子问题(阶段),按顺序求解子阶段,前一子问题的解,为后一子问题的求解提供了有用的信息。在求解任一子问题时,列出各种可能的局部解,通

2015-03-30 15:48:09 5878

原创 Leetcode: Find Minimum in Rotated Sorted Array

题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the array.

2015-03-30 10:26:55 749

原创 Leetcode: Find Peak Element

题目: A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that

2015-03-29 23:51:30 760

原创 Leetcode: Fraction to Recurring Decimal

题目: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For

2015-03-29 15:54:15 917

原创 Leetcode: Binary Search Tree Iterator

题目: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and

2015-03-29 00:08:57 1104

原创 Leetcode: Largest Number

题目: Given 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 is 9534330.Note: The result may be very l

2015-03-27 17:53:05 877

原创 C++中Lambda表达式

C++11中也支持Lambda表达式了,即匿名函数。首先看一个例子,对Lambda表达式有一个感性的认识:#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(){ int count = 10; vector<int> nums(count, 1); i

2015-03-27 16:19:11 1181

原创 Leetcode: Repeated DNA Sequences

题目:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.

2015-03-25 17:07:23 827

原创 Leetcode: ZigZag Conversion

最近在改论文,不喜欢写论文,但是为了毕业也没有办法!尽自己最大的努力做到最好吧!这道题目做完貌似所有的Easy级别的题目就做完了,开始Medium的题目!加油吧!题目:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may wan

2015-03-24 22:19:58 713

转载 Python中负数的除法和取模运算(和C比较)

一、除法:除法的取整分为三类:向上取整、向下取整、向零取整。 1. 向上取整:向+∞方向取最接近精确值的整数。在这种取整方式下,5 / 3 = 2, -5 / -3 = 2, -5 / 3 =-1, 5 / -3 = -1 2. 向下取整:向-∞方向取最接近精确值的整数。在这种取整方式下,5 / 3 = 1, -5 / -3 = 1, -5 / 3 =-2, 5 / -3 = -2

2015-03-22 19:27:56 7254

原创 Leetcode: Reverse Integer

题目: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321 题目提示: Have you thought about this?Here are some good questions to ask before coding. Bonus points for

2015-03-22 19:26:44 1299

原创 Leetcode: Palindrome Number

题目: Determine whether an integer is a palindrome. Do this without extra space.思路分析: 回文判断,题目提示不能使用直接转字符串,不能翻转数字。 那只能一个一个取出数字进行比较了。C++参考代码:class Solution{public: bool isPalindrome(int x) {

2015-03-22 14:39:33 969

原创 Leetcode: Roman to Integer

题目: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.由于不知道罗马数字和阿拉伯数字的转换规则,先百度之。 下面的关于罗马数字的说明来自百度百科:基本字符IVXLCDM相应的阿拉伯数字表示为15105010

2015-03-22 10:56:42 1038

原创 Leetcode: Longest Common Prefix

题目: Write a function to find the longest common prefix string amongst an array of strings. 即求给定的一组字符串的公共前缀。思路分析: 一个一个寻找前缀,先比较第一个和第二个,找到公共前缀,然后公共前缀和第三个比较,寻找公共前缀,以此类推。C++参考代码:class Solution{public:

2015-03-21 19:20:50 997

转载 Python常用内置函数

1.常用内置函数:(不用import就可以直接使用)      help(obj) 在线帮助, obj可是任何类型     callable(obj) 查看一个obj是不是可以像函数一样调用     repr(obj) 得到obj的表示字符串,可以利用这个字符串eval重建该对象的一个拷贝     eval_r(str) 表示合法的python表达式,返回这个表达式     d

2015-03-21 19:14:12 1175

原创 Leetcode: Remove Nth Node From End of List

题目: Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked

2015-03-21 11:56:06 891

转载 C++11新特性——引入nullprtr

1. 引入nullptr的原因引入nullptr的原因,这个要从NULL说起。对于C和C++程序员来说,一定不会对NULL感到陌生。但是C和C++中的NULL却不等价。NULL表示指针不指向任何对象,但是问题在于,NULL不是关键字,而只是一个宏定义(macro)。1.1 NULL在C中的定义在C中,习惯将NULL定义为void*指针值0:[cpp] view plai

2015-03-21 10:32:21 960

原创 Leetcode: Valid Parentheses

题目: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid

2015-03-20 21:24:30 713

原创 Leetcode: Remove Duplicates from Sorted Array

题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place wit

2015-03-19 21:59:28 627

原创 Leetcode: Remove Element

题目: Given 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 you leave beyond the new length. 这道题比

2015-03-18 21:53:37 848

原创 Leetcode: Implement strStr()

题目要求: mplement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 这道题是一个字符匹配问题,可以采用KMP算法。 下面是采用一般方法的解答:class Solution{public: int

2015-03-17 17:07:07 594

原创 KMP算法(二)

总结一下: KMP算法的思想是:设s为主串,t为模式串设i为主串s当前比较字符的位置,j为模式串t当前比较字符串的位置,令i和j的初值0。当si=tj时,i和j分别增加1然后继续比较;否则i不变,j改变为等于next[j]再继续比较。以此类推,直到下列两种情况之一:(1)j退回到某个j=next[j]时有si=tj,则i和j分别增加1再继续比较;(2)j退回j=-1,此时令主串和模式串的位置各增1

2015-03-16 21:32:39 696

原创 Leetcode: Valid Sudoku

题目: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.Sudoku规则:在一个9*9的区域内, 每行1-9

2015-03-15 11:29:40 586

原创 Leetcode: Merge Two Sorted Lists

题目: Merge 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.这道题和前面Leetcode: Merge Sorted Array 这道题看似类似,因为数据结构的不同,但是

2015-03-14 21:58:05 561

原创 Leetcode: Add Binary

题目: Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”. 分析: 思路一:刚开始我想的是将a和b转成数字,然后相加,结果在转成二进制字符。这种方法在a和b长度比较小的时候可行,a和b太长的时候,转成数字int或者long

2015-03-14 16:41:56 835

原创 Leetcode: Plus One

题目: Given 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-03-14 12:09:22 796

原创 Leetcode: Count and Say

题目: The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read off as “one 2

2015-03-13 21:14:42 653

原创 Leetcode: Climbing Stairs

题目: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 思路分析: 设 f (n) 表示爬 n 阶楼梯的不同方法数,

2015-03-13 15:39:35 599

原创 Leetcode: Merge Sorted Array

题目: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from

2015-03-13 11:44:13 917

原创 树和二叉树的转换

树和二叉树是两种不同的数据结构,树实现起来比较麻烦,但是树可以转换为二叉树进行处理,处理完以后再从二叉树还原为树。 下面说说转换的方法: 1. 树转换为二叉树 (1) 树中所有相同双亲结点的兄弟结点之间加一条连线。 (2) 对树中不是双亲结点第一个孩子的结点,只保留新添加的该结点与左兄弟结点之间的连线,删去该结点与双亲结点之间的连线。 (3) 整理所有保留的和添加的连线,使每个结点的第一个

2015-03-12 20:23:35 7839

原创 二叉树的初始化

问题:给定二叉树的初始化数据,怎样动态建立一个二叉树呢?比如我们给定这样的一组数据:{ 1, 2, 3, 4, 0, 5, 6, 0, 7 }(假设0代表空),则我们构建的二叉树是这样的: 1 / \ 2 3 / / \ 4 5 6 \ 7思路分析:我们可以使用一个队列,队首出一个元素,队未进两个元素,而这两个元素正

2015-03-12 16:26:52 21787 2

原创 Leetcode: Symmetric Tree

题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the fo

2015-03-11 15:59:50 767

原创 Leetcode: Binary Tree Level Order Traversal II

题目:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7

2015-03-10 11:32:27 574

原创 Leetcode: Binary Tree Level Order Traversal

题目:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2015-03-09 17:28:35 490

原创 Leetcode: Balanced Binary Tree

题目: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2015-03-09 15:12:24 704

原创 Leetcode: Minimum Depth of Binary Tree

题目: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.思路分析: 二叉树多用迭代C++示例代码:/** * Definitio

2015-03-09 10:57:11 591

Java基础知识

最新的java开发基础知识 从入门开始到精通

2012-09-28

Dom4J 官方下载

Dom4j官方下载,包含源码,Jar包和帮助文档

2014-03-09

exe4j_windows-x64_4_5_2

帮你轻松完成Java程序打包成exe程序,附带注册码!

2015-02-02

Android编程权威指南

国外计算机书籍翻译版本!课程从基础知识讲起,各章节内容以循序渐进的方式编排,本书旨在让你跨越学习的初始障碍,能够充分利用其他各种参考资料和代码实例类图书来深入学习。

2015-03-07

C++面向对象程序设计

学习C++的入门书籍,谭浩强C++面向对象程序设计,个人感觉知识点总结比较好,适合做查阅!

2015-02-02

VC++_2010入门经典

《VC++_2010入门经典》完全版,完全解析VC++2010,学习VC++的经典图书!

2015-02-02

语义网基础教程(中文版)

国外最经典的语义网教程,入门语义网的首选!

2015-02-02

JDBC数据库开发

想全面学习Java JDBC开发,JDBC数据库开发带你很好的入门!

2015-02-02

Expression_Blend实例中文教程

开发Silverlight程序,Expression Blend作为开发的利器,入门的好资料……

2013-03-14

JQuery UI API

JQuery开发的API帮助文档,提供详细的函数说明和用法!

2014-03-09

JavaScript使用范例宝典

JavaScript使用帮助文档,里面提供了很多示例参考

2014-03-09

JQuery API CHM

JQuery开发的API帮助文档,里面有各种函数的详细用法!

2014-03-09

Java+EE+6+API+Specifications_中文版

Java Web开发API手册 Servlet JSP官方API

2013-12-05

windowbuilder-indigo

开发Java桌面程序的Eclipse插件,以可视化的形式进行控件的拖拽!

2015-02-02

Java多线程编程

Java多线程编程的参考书籍,入门多线程编程其实很简单!

2015-02-02

Struts_Hibernate_Spring集成开发宝典

Struts_Hibernate_Spring集成开发宝典,实例讲解很详细!JavaWeb开发值得参考!

2015-02-02

ASP.NET.4.0实战

国外经典计算机教程中文版,ASP.NET.4.0实战,轻松入门ASP.NET

2015-02-02

ASP.NET基础教程

ASP.NET基础教程-C#案例版,以实例的形式进行ASP.NET的讲解!

2015-02-02

C#编程规范

想让自己的代码更规范,看看C#编程规范!

2015-02-02

TheOneGIS的留言板

发表于 2020-01-02 最后回复 2020-01-02

空空如也

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

TA关注的人 TA的粉丝

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