自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

编码之路

世之奇伟,瑰怪,非常之观常在于险远向人之所罕至焉。

  • 博客(20)
  • 资源 (1)
  • 收藏
  • 关注

原创 百度C++岗2017笔试第三题分析

百度C++岗2017年笔试题 第三题: 为了进程城市规划,需要计算居民区的住宅数目。该区域是一个n*m的网格,如果有屋顶则为1, 如果是空地则为0.有1组成的相邻网格单元组成的簇为一个单独住宅。对角为1不是一个。 输入:小区的图,由0,1表示 输出:住宅总数。 解题思路:对于每一个访问到的格子,先让它为0,然后递归访问上下左右的格子 为1,则继续访问,为0则退出。#include <io

2016-09-13 23:10:57 1715 2

原创 leetcode 241. Different Ways to Add Parentheses

/*leetcode 241. Different Ways to Add ParenthesesGiven a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The

2016-09-10 18:43:22 412

原创 apue 第5章 标准I/O库

引言标准库I/O库处理很多细节,如缓冲区分配,以优化的块长度执行I/O等流和FILE对象当打开一个文件时,即返回一个文件描述符,然后该文件描述符就用于后续的I/O操作。而对于标准I/O库,它们的操作时围绕流(stream)进行的。流可用于单字节或多字节(“宽”)字符集流的定向(stream`s orientation)决定了所读、写的字符是单字节还是多字节。只有两个函数可以改变流的定向。fr

2016-09-08 21:07:00 800

原创 leetcode 215. Kth Largest Element in an Array

/*leetcode 215. Kth Largest Element in an ArrayFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example

2016-09-08 15:07:41 371

原创 apue 第4章 文件和目录

函数stat,fstat,fstatat, lstat#include <sys/stat.h>int stat(const char *restrict pathname, struct stat *restrict buf);int fstat(int fd, struct stat *buf);int lstat(const char *restrict pathname, struct

2016-09-07 20:11:45 1971

原创 apue 第3章 文件I/O

文件I/O的主要有五个常用的函数:openreadwritelseekclose本章主要介绍不带缓存的I/O文件描述符对于内核而言,所有打开的文件都是通过文件描述符引用的。文件描述符0-标准输入,1-标准输出,2-标准错误。在POSIX规范中,已经提供了STDIN_FILENO、STDOUT_FILENO、STDERR_FILENO来替代0、1、2数字,这样更加便于开发者理解函数open

2016-09-07 20:11:07 729

原创 apue 第1章 UNIX 基础知识

0 环境配置下载:到官网 http://www.apuebook.com/code3e.html 下载 ‘src.3e.tar.gz’解压:$ tar -zvx -f src.3e.tar.gz安装libbsd:$ sudo apt-get install libbsd-dev进入apue.3e $ make将/apue.3e/include/apue.h文件拷贝到/usr/includ

2016-09-07 20:10:08 463

原创 leetcode 169. Majority Element

/*leetcode 169. Majority ElementGiven 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-emp

2016-09-07 16:43:52 385

原创 leetcode 264. Ugly Number II

/*leetcode 264. Ugly Number IIWrite a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is th

2016-09-07 15:29:46 338

原创 leetcode 334 ----字符串翻转

/*leetcode 334 ----字符串翻转 解题思路:把字符串第i个和第len-1-i个位置的字符交换即可。*/#include <iostream>#include <string>using namespace std;class Solution {public: string reverseString(string s) { int len =

2016-09-06 13:31:08 662

原创 leetcode 064. Minimum Path Sum

/* * leetcode 064. Minimum Path Sum * dp问题 dp(i,j) = min(dp(i,j-1), dp(i-1,j)) *解决思路:用一个二维数组记录从起点到每一个点的最短路径。*/#include <iostream>#include <vector>#include <algorithm>using namespace std;class Sol

2016-09-06 13:30:29 443

原创 leetcode 20. Valid Parentheses

/*leetcode 20. Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']',determine if the input string is valid.The brackets must close in the correct order,"(

2016-09-06 13:29:58 299

原创 leetcode 17. Letter Combinations of a Phone Number

/*leetcode 17. Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the tele

2016-09-06 13:29:30 379

原创 leetcode 304. Range Sum Query 2D - Immutable

/*leetcode 304. Range Sum Query 2D - Immutable Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2,

2016-09-06 13:01:49 282

原创 leetcode 151. Reverse Words in a String

/*leetcode 151. Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constitutes a wo

2016-09-05 08:49:56 390

原创 leetcode 198. House Robber

/*leetcode 198. House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amountof money stashed, the only constraint stopping you from robbing each o

2016-09-05 08:49:30 267

原创 leetcode 28. Implement strStr()

/*28. Implement strStr()Returns the index of the first occurrence of needle in haystack,or -1 if needle is not part of haystack.*/#include <iostream>#include <string>using namespace std;class Solu

2016-09-05 08:48:50 276

原创 leetcode 300. Longest Increasing

/*leetcode 300. Longest Increasing SubsequenceGiven an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest incr

2016-09-05 08:48:24 300

原创 leetcode 6. ZigZag Conversion

/*leetcode 6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rowslike this: (you may want to display this pattern in a fixed font for better legibil

2016-09-05 08:46:44 275

原创 leetcode 4. Median of Two Sorted Arrays

/*leetcode 4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be

2016-09-05 08:46:02 270

数据结构与算法分析:C语言描述_原书第2版_高清版

数据结构与算法分析:C语言描述_原书第2版_高清版

2016-04-26

空空如也

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

TA关注的人

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