自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Clearlemon

爱柠乐~

  • 博客(243)
  • 收藏
  • 关注

原创 剑指offer 09:斐波那契数列

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#defin

2015-03-09 21:43:46 546

原创 剑指offer:08 旋转数组的最小数字

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#defin

2015-03-09 21:33:33 500

原创 剑指offer :07 用两个栈实现队列

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#defin

2015-03-09 19:52:22 529

原创 剑指offer 06:重建二叉树

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#defin

2015-03-09 19:22:54 509

原创 剑指offer 05: 从尾到头打印链表

#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#define MP make_

2015-03-09 16:53:49 499

原创 剑指offer 04 :替换空格

#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#define MP make_

2015-03-09 15:46:59 358

原创 剑指offer 03:二维数组中的查找

#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define PB push_back#define MP make_

2015-03-09 15:08:30 438

原创 Linux多线程二

客户端#include #include #include #include #include #include #include #include #include #include #include #define MAXN 1024#define client_port 12580struct sockaddr_in

2015-03-09 11:34:38 428

原创 Linux多线程一

客户端#include#include #include #include #include #include #include #include #include #include #define MAXN 1024static void *thread_send(void *arg) { char str[MAXN];

2015-03-05 23:59:46 503

原创 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 ma

2015-02-11 21:48:48 676

原创 Best Time to Buy and Sell Stock II

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 as many transactions as you like (ie, buy on

2015-02-11 21:17:54 482

原创 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2015-02-11 21:00:45 520

原创 Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2015-02-11 20:43:54 544

原创 Unique Paths II

Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the

2015-02-11 20:33:52 782

原创 Unique Paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the

2015-02-11 20:14:56 562

原创 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] 

2015-02-10 22:56:09 452

原创 Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [

2015-02-10 22:51:22 499

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

2015-02-10 21:55:54 462

原创 Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for binary tree

2015-02-10 21:33:44 703

原创 Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of

2015-02-10 21:21:13 470

原创 Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".class Solution {public: string addBinary(string a, string b) { reve

2015-02-10 20:53:21 472

原创 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 va

2015-02-10 20:21:23 454

原创 Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum

2015-02-09 23:37:54 525

原创 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./** * Definition for singly-linked list. * struct Lis

2015-02-09 22:36:06 466

原创 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 ca

2015-02-09 22:07:49 422

原创 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.class Solution {pub

2015-02-08 22:50:21 702

原创 Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,

2015-02-08 20:08:17 496

原创 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 with

2015-02-08 19:08:00 433

原创 Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2015-02-08 12:12:44 550

原创 冒泡,插入,归并排序

#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const int n=10;void maopao(const in

2015-02-07 22:43:05 430

原创 Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321简单模拟class Solution {public: int reverse(int x) { char s[1111]; sprintf(s,"%d",

2014-10-29 19:53:53 721

原创 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?简单递推class Solution {pub

2014-10-29 19:35:56 811

原创 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)).题意:寻找两个有序数组的中位数,要求复杂度为O(log (m+

2014-10-29 19:28:05 869

原创 退役了。。。

两场都有拿银的机会,结果do

2014-10-26 16:21:25 655

原创 Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe

2014-10-26 16:12:24 796

原创 ZOJ 3229 Shoot the Bullet 无源汇上下界最大流

Shoot the BulletTime Limit: 2 Seconds      Memory Limit: 32768 KB      Special JudgeGensokyo is a world which exists quietly beside ours, separated by a mystical border. It is a utopia where h

2014-10-10 15:02:50 990

原创 SGU 194 Reactor Cooling 无源汇带上下界可行流

Reactor Coolingtime limit per test: 0.5 sec.memory limit per test: 65536 KBinput: standardoutput: standardThe terrorist group leaded by a well known international terrorist Ben

2014-10-10 10:24:35 1201

原创 UVA 11324 The Largest Clique 强连通缩点+DP

Problem B: The Largest CliqueGiven a directed graph G, consider the following transformation. First, create a new graph T(G) to have the same vertex set as G. Create a directed edge between two

2014-10-09 20:00:26 635

原创 FZU 2039 Pets 二分图匹配

PetsAccept: 278    Submit: 751Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem DescriptionAre you interested in pets? There is a very famous pets shop in the center of the ACM

2014-10-09 16:08:11 630

原创 POJ 3177 & 3352 边双连通分支

两题都是同样的意思,给定一张无向图G,

2014-10-09 11:08:20 587

空空如也

空空如也

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

TA关注的人

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