自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 资源 (2)
  • 收藏
  • 关注

原创 leetcode:Valid Parentheses [20]

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 va

2016-08-16 22:08:14 196

原创 leetcode:Remove Nth Node From End of List [19]

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

2016-08-16 22:06:55 201

原创 leetcode:4Sum [18]

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: The solution

2016-08-15 10:14:46 175

原创 leetcode:Letter Combinations of a Phone Number [17]

Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st

2016-08-15 10:13:40 141

原创 leetcode:3Sum Closest [16]

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact

2016-08-11 22:08:49 146

原创 leetcode:3Sum [15]

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain

2016-08-11 22:07:06 142

原创 leetcode:Longest Common Prefix [14]

Write a function to find the longest common prefix string amongst an array of strings.class Solution {public: string longestCommonPrefix(vector& strs) { if (strs.size() == 0) return "";

2016-08-09 22:29:42 147

原创 leetcode:Roman to Integer [13]

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.class Solution {public: int getVal(char a) { switch (a) { case 'I': return 1

2016-08-09 22:27:31 147

原创 leetcode:Integer to Roman [12]

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.class Solution { public: string intToRoman(int num) { string thousand[

2016-08-08 21:15:31 212

原创 leetcode:Container With Most Water [11]

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i,

2016-08-08 21:13:41 163

原创 leetcode:Regular Expression Matching [10]

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 st

2016-08-06 21:43:57 210

原创 leetcode:Palindrome Number [9]

Determine whether an integer is a palindrome. Do this without extra space.class Solution {public: bool isPalindrome(int x) { int d = x; int a = 0; if (x >= 0) while (x != 0) { a

2016-08-06 21:42:38 164

原创 leetcode[7] Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321class Solution {public: int reverse(int x) { if (x > 0) { int a = 0, b; while (x > 0)

2016-08-04 10:54:42 133

原创 leetcode[6] ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I

2016-08-04 10:53:26 122

原创 leetcode[5] Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.clas

2016-08-04 10:51:38 173

原创 leetcode:Word Search II

题目:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are th

2016-07-18 21:45:56 168

转载 c++ 虚函数的实现机制:笔记

1、c++实现多态的方法其实很多人都知道,虚函数在c++中的实现机制就是用虚表和虚指针,但是具体是怎样的呢?从more effecive c++其中一篇文章里面可以知道:是每个类用了一个虚表,每个类的对象用了一个虚指针。具体的用法如下:class A{public:    virtual void f();    virtual void g();private

2016-07-18 21:17:04 174

原创 leetcode:Course Schedule

题目:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expr

2016-07-16 21:22:53 156

原创 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.Wri

2016-07-14 21:17:43 166

原创 leetcode之Construct Binary Tree from Preorder and Inorder Traversal

题目:Given preorder and inorder traversal of a tree, construct the binary tree.根据前序序列和中序序列构建二叉树。思路:前序序列的第一数必然是根结点,中序序列中,在该根结点前面的数均为根结点的左子树结点,该结点后面的数均为根结点的右子树结点,根据这个规律不断递归即可构建完整的二叉树。代码/** * De

2016-06-27 09:00:38 195

原创 VS2015下一些问题解决方法

errorc4996的解决方法#define_CRT_SECURE_NO_DEPRECATE vs使用sort的函数必须添加如下语句#includeusingstd::sort; 解决运行完程序窗口自动关闭对该项目点右键->属性->链接器->系统在子系统那边选控制台

2016-04-27 14:46:42 206

原创 leetcode-35. Search Insert Position

Given 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 may assume no duplicates in the array.

2016-04-27 14:40:40 193

原创 leetcode-34. Search for a Range

class Solution {public: vector searchRange(vector& nums, int target) { int start = 0, end = nums.size() - 1; vector search; if (nums.empty()) { search.push_back(-1); search.push_back(-1)

2016-04-27 14:34:09 306

原创 [LeetCode]3. Longest Substring Without Repeating Characters

题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answ

2016-04-23 14:32:42 180

原创 [LeetCode]1. Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums =

2016-04-17 23:03:57 190

原创 error LNK2038 RuntimeLibrary 不匹配的解决

在工程上右键-》属性-》c/c++-》代码生成-》运行库error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”因为所选的工程运行库选择错误导致的。其中四个选项的对应含义如下:多线程调试Dll (/MDd) 对应的是MD_Dyna

2015-12-28 21:29:18 305

转载 在Storm中使用C++开发Bolt总结

原文地址:http://blog.csdn.net/jmppok/article/details/16827837参考1:storm下运行C++程序(一)http://blog.csdn.net/jmppok/article/details/15501947参考2:Storm下运行C++(二)http://blog.csdn.net/jmppok/art

2015-09-08 07:56:37 564 1

转载 ubuntu下使用codeblocks编程运行时终端不能复制粘贴的解决方法

环境:ubuntu 12.04codeblocks 10.05问题:使用codeblocks编程运行时终端不能复制粘贴解决:settings-->environment-->generalsettings-->Terminal to launch console programs:把方框里默认的终端改成 gnome-terminal -t $

2015-08-26 09:05:48 821

转载 C++ ERROR redefinition of ‘class ***’

报错如下:BaseSmoothingAlgorithm.h:4:7: error: redefinition of ‘class BaseSmoothingAlgorithm’BaseSmoothingAlgorithm.h:4:7: error: previous definition of ‘class BaseSmoothingAlgorithm’排错步骤:1

2015-08-24 08:28:36 4275

转载 error: ‘exit’ was not declared in this scope 的解决方法

刚开始用linux和G++写程序,碰到的错误可谓是五花八门,如下面的错误error: ‘exit’ was not declared in this scope解决方法是添加#include

2015-08-24 08:05:43 1198

原创 linux下打不开eclipse for c/c++的解决方法

liunx 无法启动,log中显示could not resolve module。在/etc/environment中补充PATH,重启,就可以双击打开ECLIPSE了.或者因为eclipse默认在自己的目录下找jre,so建立一个软连接就可以解决: $ cd  $ ln -sf $JAVA_HOME/jre jre

2015-08-14 11:28:07 423

原创 storm提交jar包

storm jar all-my-code.jar backtype.storm.MyTopology arg1 arg2这个命令会运行主类: backtype.strom.MyTopology, 参数是arg1, arg2。这个类的main函数定义这个topology并且把它提交给Nimbus。storm jar负责连接到Nimbus并且上传jar包。

2015-08-13 15:43:31 510

原创 Storm编译打包过程中遇到的一些问题及解决方法

下面是在编译Storm过程中遇到的一些问题以及解决办法:问题1:下载lein 2.3.4,如果使用root用户,运行lein sub install编译时报了WARNING信息。WARNING: You're currently running as root; probably by accident.Press control-C to abort or Enter to c

2015-08-13 09:28:37 333

转载 Kafka集群安装

首先了解几个kafka中的概念:kafka是一个消息队列服务器,服务称为broker, 消息发送者称为producer, 消息接收者称为consumer;通常我们部署多个broker以提供高可用性的消息服务集群.典型的是3个broker;消息以topic的形式发送到broker,消费者订阅topic,实现按需取用的消费模式;创建topic需要指定replication-factor(复制数目,

2015-05-29 23:48:30 310

转载 HDU 2063 过山车(基础二分匹配)模板题

Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿

2015-05-03 21:12:13 323

原创 HDU1233最小生成树之kruskal算法加并查集

最小生成树之kruskal算法加并查集最小

2014-11-24 21:01:04 292

C#写的植物大战僵尸

用C#写的植物大战僵尸,可以让GIF动画动起来,实现原版游戏的基本功能,包括选择道具、收集阳光、放置道具等,里面有做植物大战僵尸需要的图片源

2016-07-17

用C#写的植物大战僵尸,可以让GIF动画动起来哦

用C#写的植物大战僵尸,可以让GIF动画动起来哦,写得比较粗糙,但用来参考绝对足够了,里面有做植物大战僵尸需要的图片源

2013-05-05

空空如也

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

TA关注的人

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