自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 收藏
  • 关注

原创 如何在windows7操作系统下搭建用于开发网站的web服务器环境

相信很多人和我一样,都想过搭建一个自己的web服务器,设计一个网站,好让别人来访问。 怎么在windows下实现呢?方法其实非常简单,你既不需要任何特别的操作系统,也不需要租用别人的服务器,你自己的计算机就可以实现你要的功能。 怎么实现呢?互联网上最经典的网站架构叫做LAMP,指的是Linux, Apache, MySQL 以及 PHP,既然我们的计算机不是Linux操作系统,那就稍作改变,改为

2015-09-22 12:45:10 1343

原创 如何在Windows7操作系统下使用g++命令

Windows下使用CMD,可以像Linux下一样使用g++命令配置的方法很简单 1. 去MinGW的官网下载MinGW,这是C++的编译器 http://www.mingw.org/ 2. 将默认工具安装在默认地址,记下bin文件夹所在地址 3. 类似于配置JDK,将C++的bin文件夹所在地址添加到PATH路径 computer -> properties -> Advance

2015-09-04 23:46:42 1141

原创 如何在Windows7操作系统下安装用于C++开发的Eclipse

在windows下开发C++程序,我用过的最多的环境是Dev-C++。 Dev-C++很简洁,安装简单,直接去官网下载安装到C盘即可。Eclipse相对于Dev-C++而言是一款功能更加强大的开发环境,它的安装要更多的步骤。配置JDK 1.1 下载JDK,安装,并记录下安装位置,找到bin文件夹所在地 http://www.oracle.com/technetwork/java/javase

2015-09-03 01:07:04 576

原创 [Tree]Family

//Created: July 2nd, 2015 Thu//Last Modified: July 5th, 2015 Sun//A Non-Linear Data Structure - Tree//Note: On July 3rd, 2015. Initially I designed this Tree in this way, that only children know the

2015-09-02 08:19:11 365

原创 [Linked_List]Book

//Created: May 26th, 2015//Last Modified: July 2nd, 2015 Tue//Linear List "BookList", implemented in Linked List (1-way)//Linear List "BookArray", implemented in Dynamic Array//Note: On June 29th,

2015-09-02 08:18:37 312

原创 [Leetcode]#258 Add Digits

//#258 Add Digits//28ms unknown distributionclass Solution {public: int addDigits(int num) { while(num > 9) { vector<int> digits = pushVector(num); n

2015-09-02 08:13:59 304

原创 [Leetcode]#237 Delete Node in a Linked List

//#237 Delete Node in a Linked List//20ms 8.09%/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} *

2015-09-02 08:12:38 201

原创 [Leetcode]#234 Palindrome Linked List

//#234 Palindrome Linked List//32ms 14.13%/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *

2015-09-02 08:11:16 174

原创 [Leetcode]#231 Power of Two

//#231 Power of Two//8ms 98.07%class Solution {public: bool isPowerOfTwo(int n) { int m = n & (n-1); return ( (n > 0) && (m == 0) ); }};

2015-09-02 08:09:10 254

原创 [Leetcode]#228 Summary Ranges

//#228 Summary Ranges//0ms 100%class Solution {public: void int_string(string& s, int num) { if(num < 0) { s.push_back('-'); } int size = s.size()

2015-09-02 08:06:48 247

原创 [Leetcode]#223 Rectangle Area

//#223 Rectangle Area//32ms 98.98%class Solution {public: int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int c1(0), c2(0), c3(0), c4(0); if(A>=E)

2015-09-02 08:04:42 291

原创 [Leetcode]#219 Contains Duplicate II

//#219 Contains Duplicate II//76ms 12.69%#include <iostream>#include <vector>#include <set>#include <map>using namespace std;class Solution {public: bool containsNearbyDuplicate(vector<int>&

2015-09-02 08:03:37 260

原创 [Leetcode]#217 Contains Duplicate

//#217 Contains Duplicate//88ms 27.67%#include <iostream>#include <vector>#include <set>using namespace std;class Solution {public: bool containsDuplicate(vector<int>& nums) { se

2015-09-02 08:00:57 192

原创 [Leetcode]#206 Reverse Linked List

//#206 Reverse Linked List//8ms 100%#include <iostream>using namespace std;class Solution {public: ListNode* reverseList(ListNode* head) { ListNode *previous_p, *current_p, *next_

2015-09-02 07:59:45 263

原创 [Leetcode]#203 Remove Linked List Elements

//#203 Remove Linked List Elements//36ms 67.75%/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} *

2015-09-02 07:58:42 212

原创 [Leetcode]#202 Happy Number

//#202 Happy Number//640ms 0%class Solution {public: int addHappyVector(vector<int> v) { int sum(0); for(unsigned int i=0; i<v.size(); i++) { sum = sum +

2015-09-02 07:57:11 269

原创 [Leetcode]#189 Rotate Array

//#189 Rotate Array//24ms 100%class Solution {public: void rotate(vector<int>& nums, int k) { if(nums.size() == 0 || nums.size() == 1) return; k = k % nums.size(); i

2015-09-02 07:55:56 247

原创 [Leetcode]#171 Excel Sheet Column Number

//#171 Excel Sheet Column Number//8ms 100%class Solution {public: int titleToNumber(string s) { int s_num(0); int j(0); for(string::reverse_iterator r_it = s.rbegin(

2015-09-02 07:54:44 258

原创 [Leetcode]#169 Majority Element

//#169 Majority Element//20ms 88.35%class Solution {public: int majorityElement(vector<int>& nums) { int x(0), m(0); for(unsigned int i=0; i<nums.size(); i++) {

2015-09-02 07:53:36 234

原创 [Leetcode]#168 Excel Sheet Column Title

//#168 Excel Sheet Column Title//0ms 100%class Solution {public: string convertToTitle(int n) { string result; int remainder(0); while(n!=0) { re

2015-09-02 07:52:15 282

原创 [Leetcode]#166 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 exam

2015-09-02 07:50:47 184

原创 [Leetcode]#165 Compare Version Numbers

Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and conta

2015-09-02 07:49:26 419

原创 [Leetcode]#160 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-09-02 07:47:57 227

原创 [Leetcode]#148 Sort List

//#148 Sort List//60ms 96.38%#include <iostream>using namespace std;class Solution {public: ListNode* sortList(ListNode* head) //decided to use "marge sort", recurrence as the way to sol

2015-09-02 07:46:37 222

原创 [Leetcode]#147 Insertion Sort List

//#147 Insertion Sort List//80ms 81.07%#include <iostream>using namespace std;/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i

2015-09-02 07:45:14 232

原创 [Leetcode]#143 Reorder List

https://leetcode.com/problems/reorder-list///#143 Reorder List//64ms 97.92%/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x)

2015-09-02 07:43:15 332

原创 [Leetcode]#141 Linked List Cycle

https://leetcode.com/problems/linked-list-cycle///#141 Linked List Cycle//12ms 100%/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNod

2015-09-02 07:39:39 246

原创 [Leetcode]#136 Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra me

2015-09-02 07:37:59 173

原创 [Leetcode]#125 Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin

2015-09-02 07:34:36 243

原创 [Leetcode]#119 Pascal's Triangle II

Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?//#119 Pascal's Triangle

2015-09-02 07:32:49 205

原创 [Leetcode]#118 Pascal's Triangle

Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]//#118 Pascal's Triangle//0ms

2015-09-02 07:31:25 203

原创 [Leetcode]#92 Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following co

2015-09-02 07:28:59 380

原创 [Leetcode]#88 Merge Sorted Array

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

2015-09-02 07:27:06 222

原创 [Leetcode]#86 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 the

2015-09-02 07:20:55 301

原创 [Leetcode]#83 Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. //#83 Remove Duplicates from So

2015-09-02 07:19:02 258

原创 [Leetcode]#82 Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2

2015-09-02 07:17:37 300

原创 [Leetcode]#78 Subsets

Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example, If nums

2015-09-02 07:16:06 171

原创 [Leetcode]#74 Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each row is

2015-09-02 07:14:45 182

原创 [Leetcode]#69 Sqrt(x)

//#69 Sqrt(x)//8ms 100%class Solution {public: int mySqrt(int x) { //x is guarantted to be valid //x has to be equal or larger than 0 if(x == 0) return 0; if

2015-09-02 07:13:00 243

原创 [Leetcode]#67 Add Binary

Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”. //#67 Add Binary//172ms 0.47%class Solution {public: string addBinary(string a, s

2015-09-02 07:09:15 239

空空如也

空空如也

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

TA关注的人

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