自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 TCP 回射程序

TCP回射程序回射程序步骤客户端从标准输入读入一行文本,并发给服务器服务器从网络输入读入这行文本,并且回射给客户客户从网络输入读入这行回射文本,并且显示在标准输出上。回射流程TCP 回射服务器#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h

2017-04-17 16:03:49 750

原创 基本TCP套接字编程

基本TCP套接字编程概述基本TCP客户/服务器程序的套接字函数 socket函数 #include <sys/socket.h> int socket(int family, int type, int protocol) 返回:若成功则为非负描述符,若则为-1其中 family 参数指明协议族,为某个常值。该参数也往往称为协议域。 family 说明 AF_INE

2017-04-12 20:55:40 384

原创 228. Summary Ranges

题目 Given a sorted integer array without duplicates, return the summary of its ranges.样例 For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”]解答采用遍历的方法,如果后一个数不等于前一个数字加上+1 就证明后面的数字和前面的数字不在一个

2016-12-20 15:09:36 298

原创 216. Combination Sum III

题目 Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.样例 Example 1: In

2016-12-12 21:55:39 265

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

2016-12-11 09:49:06 333

原创 153. 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 ex

2016-12-10 10:58:41 325

原创 209. Minimum Size Subarray Sum

题目 Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.样例 For example, given the array

2016-12-09 16:05:40 316

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

2016-12-09 08:48:28 332

原创 167. Two Sum II

题目 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two nu

2016-12-07 16:19:33 378

原创 64. 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.解答方法一:递归这个方法会超过时间限制 调用moveStep(grid,1,1);int move

2016-12-06 09:59:51 409

原创 283. Move Zeroes

题目 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.样例 For example, given nums = [0, 1, 0, 3, 12], after calling

2016-12-05 17:25:34 471

原创 1031: Mincost

题目描述 The cost of taking a taxi in Hangzhou is not a constant for each kilometer you travel: the first 4 kilometers costs 10 yuan (yuan is the monetary unit in China), even if you don’t finish it; the

2016-12-05 08:42:59 619

原创 189. Rotate Array

题目 Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].解答方法一利用STL中的rotate方法 Exchanges the elements

2016-12-04 16:05:25 396

原创 1227: Gang Black and Gang White

题目描述 There are only two gangs in the city, Gang Black and Gang White. There are N persons(2<=N<=50000) who belong to these two gangs(one person only belongs to one gang). They are numbered from 1 to

2016-12-04 14:45:41 496

原创 169. Majority Element

题目 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority elemen

2016-12-03 17:58:56 428

原创 1256: Nuclear Missile

题目描述 Country Uranux wants to launch its new nuclear missile recently. There are 3 types of missiles that Uranux has developed successful: Name: Juno Price per unit: 120millionRange:450kmName:

2016-12-03 10:52:26 716

原创 1295: Fengsensei的测试

题目描述 Fengsensei最近新买了一台电脑,为了对cpu有更加深入的了解,Fengsensei开始了对这台电脑的双核 cpu进行测试。为了简化问题,我们进行如下的定义,cpu有两个核分别为A和B,每次测试共有n(n<100)个任务,每个任务在A,B上执行的时间分别为Ai,Bi(Ai,Bi<100).每个任务只能在cpu的其中一个核上执行,现在Fengsensei想知道执行完这些任务所需要的

2016-12-03 10:47:08 673

原创 Git常用命令

Git介绍Git是一个优秀的分布式协作版本控制工具。相对于其他版本控制软件更加轻量级,具有一些列优点。使用本文主要是是自己学习Git过程中的一些学习记录。学习的时候主要是通过阅读廖雪峰老师的Git教程来学习的。先对一些基础进行总结安装linux: sudo apt-get install git windows msysgit配置$ git config --global user.name "Y

2016-12-03 10:37:03 604

原创 windows 下Git服务器搭建

windows 下Git服务器搭建本文主要使用的是 Gogs来搭建自己的Git服务器。选用Gogs的原因主要是搭建起来快捷,方便。相对于其他的搭建方法,配置简单,便于维护。大家有兴趣可以去Gogs官网去查看关于Gogs 的更多信息。配置的环境要求数据库 MySQL: 版本大于5.5.3Git 应该在本地服务器上都装上Git, Windows 系统建议使用最新版Git。我使用的是Git 下载

2016-12-02 20:35:39 1172

空空如也

空空如也

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

TA关注的人

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