自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

程序员的自我修养

积跬步 积小流

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

原创 getopt、getopt_long和getopt_long_only解析命令行参数

一:posix约定:         下面是POSIX标准中关于程序名、参数的约定:         程序名不宜少于2个字符且不多于9个字符;          程序名应只包含小写字母和阿拉伯数字;          选项名应该是单字符或单数字,且以短横 ‘-’ 为前綴;         多个不需要选项参数的选项,可以合并。(譬如:foo  -a -b -c  ----> fo

2015-07-30 21:44:03 1696

原创 Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by thecharacter '.'.You may assume that there will be only one unique solution.

2015-07-28 22:03:16 461

原创 Python深入:编码问题总结

一:字符编码简介         1:ASCII         最初的计算机的使用是在美国,所用到的字符也就是现在键盘上的一些符号和少数儿个特殊的符号,一个字节所就能足以容纳所有的这些字符,实际上表示这些字符的字节最高位都为0,也就是说这些字节都在0到127之间,如字符a对应数字97。这套编码规则被称为ASCII(美国标准信息交换码)。          2:GBK、GB2312

2015-07-26 16:15:55 19642 1

原创 Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found in t

2015-07-20 12:45:13 478

原创 Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 01 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its i

2015-07-19 22:48:59 401

原创 Substring with Concatenation of All Words

You are given a string, s, and a list of words, “words”, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and

2015-07-16 18:28:49 422

原创 Divide Two Integers

Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT. 思路:实现两个整数的除法,不能使用乘法,除法和移位操作。首先想到的是减法,但是减法速度太慢,比如10000000/1,总共需要10000000次减法,所以不适用。

2015-07-16 12:41:18 433

原创 Python基础:28正则表达式

一:概述        正则表达式(RE)为高级文本模式匹配,以及搜索-替代等功能提供了基础。正则表达式(RE)是一些由字符和特殊符号组成的字符串,它们能匹配多个字符串。Python通过标准库的re模块支持正则表达式。        在Python中,有两种主要方法完成模式匹配:搜索(searching)和匹配(matching)。搜索是在字符串任意部分中查找匹配的模式;而匹配是指判断一个

2015-07-15 23:26:28 731

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

2015-07-15 16:48:19 702

原创 Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain asit is.

2015-07-14 22:29:39 609

原创 Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路:要快速找到k个元素中的最小值,使用堆这种数据结构。找到最小值后,还需要知道该最小值出自哪个链表,因此,堆中还需记录每个节点来自哪个链表。调整堆的时间复杂度为O(logk),所以总体时间复杂

2015-07-14 17:50:25 384

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed  parentheses.For  example, given n = 3, a solution set is:"((()))","(()())", "(())()", "()(())", "()()()"

2015-07-14 11:32:24 471

原创 Container With Most Water

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 end points of line i is at (i, ai) and (i, 0). Find two

2015-07-13 10:50:12 451

原创 Regular Expression Matching

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 i

2015-07-12 21:35:30 470

原创 Median of Two Sorted Arrays

There 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 O(log (m+n)). 思路:首先注意一点,这里所谓的”the me

2015-07-12 14:38:36 414

原创 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. 

2015-07-12 10:14:23 488

原创 Longest Valid Parentheses

Given  a string containing just the characters '(' and ')',find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",which

2015-07-10 10:54:11 475

原创 LInux下编译发生的libc相关错误

在某主机上编译程序,发生有找不到libc的问题,自己写了个简单的hello world程序,编译也失败,报错如下:# gcc -o 1 1.c/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libc.so when searching for -lc/usr/bin

2015-07-06 17:23:29 7754

柔性数组成员

C99中引入了柔性数组成员的概念。C99 中,结构体中的最后一个元素允许是未知大小的数组,称为柔性数组成员(flexible array member),柔性数组成员前面必须至少还有一个其他成员,而且柔性数组成员必须是结构体的最后一个成员。一个包含柔性数组成员的结构体或(递归的)包含这样结构体的联合体,不能成为一个结构体的成员或数组的元素。

2018-09-26

空空如也

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

TA关注的人

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