自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(79)
  • 资源 (6)
  • 收藏
  • 关注

原创 Remove Linked List Elements [leetcode]

Remove Linked List ElementsRemove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5 题意: 删除给定的节点

2015-05-29 09:53:05 559

原创 Contains Duplicate [leetcode] 判断数组中是否有重复的元素

Contains Duplicate题意:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false

2015-05-28 20:07:28 1701

原创 [leetcode](Add Binary C语言实现)

Add Binary Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”. 题意:求两个二进制字符串相加,并把结果保存为二进制字符串。 解题思路:动态申请一个数组用于保存相加后的二进制字符串,两个二进制相加有两种可能: 1

2015-04-21 12:55:39 2008

原创 [leetcode](Remove Duplicates from Sorted Array II C语言实现)

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

2015-04-20 00:30:59 705

原创 [leetcode](Remove Duplicates from Sorted List II C语言实现)

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-

2015-04-19 23:06:36 804

原创 [百度2016实习 在线笔试 编程第一题 度度熊 C语言]

最粗暴的实现算法,没有考虑优化问题。#include<stdio.h>#include <string.h>int function(char *str);int main(){ int num,temp,i; char s[100][10002]; scanf("%d",&num); temp = num;i = 0; while(num--){

2015-04-19 21:57:21 1278

原创 [leetcode](Gray Code 格雷码 C语言实现)

Gray Code The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequen

2015-04-19 18:22:14 2880

原创 [leetcode]Reverse Linked List II (反转链表值 C语言实现)

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

2015-04-18 22:38:43 1029

原创 [leetcode]Validate Binary Search Tree (判断有效二叉搜索树 C语言实现)

Validate Binary Search Tree Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less t

2015-04-17 00:57:35 1492

原创 [leetcode]Construct Binary Tree from Preorder and Inorder Traversal(根据前序、中序遍历确定一棵二叉树 C语言)

Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree. 题意:

2015-04-15 23:38:46 1047

原创 [leetcode]Convert Sorted Array to Binary Search Tree (有序数组转化为二叉搜索树 C语言)

Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题意:给定一颗有序数组,求出二叉搜素树 解题思路:二叉搜索树满足的条件是:左子树<根节点<右子树 采用递归思路

2015-04-15 00:58:45 644

原创 [leetcode]Construct Binary Tree from Inorder and Postorder Traversal (利用中序遍历和后续遍历确定一颗二叉树)

Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.

2015-04-15 00:50:54 708

原创 读取一个字符串,输出它里面字符的所有组合

例如:abc,它的所有字符组合为a,b,c,ab,ac,bc,abc 对于这种类型的题,想到的第一思路就是采用递归进行求解。 首先我们申请一个与所求字符串一样大小的字符数组s,用于保存各个字符的组合。 对于abc这样字符串的进行递归实现: a,ab,abc,ac,b,bc,c 实现代码:#include <stdio.h>#include <string.h>int Recursion(

2015-04-12 17:12:50 2141 1

原创 给定一个数N,要求列出所有不大于N的素数

对于素数的定义,可以参考百度百科,素数(质数),除了可以被本身及1整除以外,不会再被其他数整除。典型的素数例如,2 3 5 7 11 13 17 19 23 …… 最简单的方法就是遍历这个整数m,遍历它可能存在的所有除数,例如对于11(1,2,3,4,5,6,7,8,9,10,11)只有1和11能被整除,所以判断11为素数,而对于12(1,2,3,4,5,6,7,8,9,10,11,12)可以被(

2015-04-12 14:07:43 4340 1

原创 [leetcode]Valid Sudoku(判断有效数独 C语言实现)

Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.A partially filled

2015-03-30 21:55:59 4169

原创 [leetcode]Count and Say (伯爵说 C语言实现)

Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read of

2015-03-30 19:09:43 1669

原创 [leetcode]Length of Last Word (求最后一个单词的长度 C语言实现)

Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note

2015-03-30 09:58:59 1021

原创 [leetcode]Climbing Stairs(爬楼梯 C语言)

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? 题意:你去爬楼梯,需要爬n个台阶,你

2015-03-28 19:02:08 3187

原创 [leetcode]Remove Duplicates from Sorted List (删除有序节点的值重复的节点 C语言)

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

2015-03-28 18:17:40 1190

原创 [leetcode]Merge Sorted Array (两个有序数组的合并 C语言实现)

Merge Sorted Array Given two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additiona

2015-03-28 16:12:57 812

原创 [leetcode]Same Tree(判断两个二叉树是否相等 C语言实现)

Same Tree Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 题意:比较两

2015-03-27 21:46:31 2887 1

原创 [leetcode]Maximum Depth of Binary Tree (求二叉树的最大深度 C语言)

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. 题意:给定一个二进制

2015-03-27 21:03:54 831

原创 [leetcode]Symmetric Tree (对称树 C语言实现)

Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:1 / \ 2 2 / \ / \ 3 4 4

2015-03-27 20:54:04 761

原创 [leetcode]Path Sum (分支求和 C语言)

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

2015-03-26 23:01:46 657

原创 [leetcode]Pascal's Triangle II (杨辉三角形求输出第k行的值)

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?

2015-03-26 16:56:08 1328

原创 [leetcode]Valid Palindrome (判断回文数 C语言实现)

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

2015-03-26 15:37:22 1703

原创 [leetcode]Min Stack (获取栈的最小元素C语言实现)

Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top()

2015-03-26 10:30:57 2640

原创 [leetcode]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 ↘ c1

2015-03-25 21:59:16 538

原创 [leetcode] Excel Sheet Column Title (excel表格的数字转字母表示格式) C语言实现

Given a positive integer, return its corresponding column title as appear in an Excel sheet. for example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 题目的意思是:把1-26的数字转

2015-03-25 20:00:34 1309

原创 Compare Version Numbers 版本号比较 C语言实现

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-03-25 19:47:35 3141

原创 connect函数

TCP客户用connect函数来建立与TCP服务器的连接。#include <sys/socket.h>int connect(int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);sockfd是由socket函数返回的套接字描述符,第二个参数、第三个参数分别是一个指向套接字地址结构的指针和该结构的大小。套接字地址结构必须含

2015-03-16 21:14:51 1914

原创 socket函数

为了执行网络I/O,一个进程必须做的第一件事就是调用socket函数,指定期望的通信协议类型#include <sys/socket.h>int socket(int family, int type, int protocol); 返回:若成功则为非负的描述符,若出错则为-1其中,family参数指明协议族,图1中所示的某个常值,该参数也往往被称为协议域。type参数指明

2015-03-16 16:12:07 455

原创 readn,writen,readline函数

字节流套接字上的read和write函数所表现的行为不同于通常的文件I/O。字节流套接字上调用的read和write输入或输出的字节数可能比请求的数量少,然而这不是出错的状态,这个现象的原因在于内核中用于套接字的缓冲区可能已达到了极限, 此时所需要的是调用者再次调用read和write函数,以输入或输出剩余的字节。为防止万一,不让实现返回一个不足的字节计数值,我们总是改为调用readn和writen

2015-03-16 12:33:17 1108

原创 inet_pton、inet_ntop函数

inet_pton和inet_ntop函数 这两个函数是随IPv6出现的函数,对于IPv4地址和IPv6地址都适用,函数中p和n分别代表表达(presentation)和数值(numeric)。地址的表达格式通常是ASCII字符串,数值格式则是存放到套接字地址结构的二进制值。#include <arpe/inet.h>int inet_pton(int family, const char *s

2015-03-16 11:54:57 4591

原创 inet_aton、inet_addr、inet_ntoa函数

inet_aton、inet_addr、inet_ntoa函数 (1)inet_aton、inet_addr、inet_ntoa在点分十进制数串与它长度为32为的网络字节序二进制值间转换IPv4地址。#include <arpa/inet.h>int inet_aton(const char *strptr, struct in_addr *addrptr);

2015-03-16 11:07:19 1401

原创 字节序测试函数

字节排序函数 考虑一个16位的整数,它由2个字节组成,内存中存储这两个字节有两种方法,一种是将低序字节存储在起始地址,这称为小端(little–endian)字节排序;另一种是将高序字节存储在起始地址,这称为大端(big–endian)字节序。如图所示: 在该图中,我们在顶部标明内存增长的方向为从右到左,在底部标明内存地址增长的方向为从左到右。我们还标明最高有效位(MSB)是这个16位值最左

2015-03-16 10:07:57 673

原创 JPEG编码简单介绍

用于压缩连续色调静止图像的JPEG(Joint Photographic ExpertsGroup,联合摄影专家组)标准是由摄影专家在ITU、ISO和IEC等其他标准组织的支持下开发出来的。JPEG标准对于多媒体而言是十分重要的,因为用于压缩运动图像的标准MPEG不过是分别对每一帧进行JPEG编码,再加上某些帧间压缩和运动补偿等额外的特征。JPEG定义在10918号国际标准中,它具有4种模式和多选

2015-03-07 10:47:18 1907

原创 linux利用test命令的测试功能

当要检测系统上的某些文件或者相关属性时,利用test这个命令来工作:测试的标志代表意义-e该文件名是否存在-f该文件名是否存在且为文件-d该文件名是否存在且为目录-b该文件名是否存在且为一个block device设备

2015-02-03 16:58:00 606

原创 linux下的通配符与特殊符号

在bash的操作环境中海油一个非常有用的功能,那就是通配符(wildcard)。我们呢利用bash处理出具就更加方便了。下面我们列出一些常用的通配符,符号意义*代表0个到无穷多个任意字符?代表一定有一个任意字符[]同样代表一定有一个在中括号内的字符(非任意字符)。例如[abcd]代表有一个字符,可能是a,b,c,d这四个的任何

2015-02-03 10:14:50 507

原创 函数signal

UNIX系统信号机制最简单的接口是signal函数。#include void (*signal(int signo, void (*func)(int)))(int); 返回值:若成功,返回以前的信号处理配置;若出错,返回SIG_ERRsigno参数如下。fun

2015-01-25 11:51:19 640

unpv13e.zip

unpv13e 并附带了error.c文件,下载下来后,把error.c文件与unp.h和config.h文件一起放到/usr/include/目录下,就防止报err_sys()错误了。

2015-01-12

cocos2d-x 贪食蛇源码

利用cocos2d-x写的C++游戏——贪食蛇,发布出来希望大家相互学习,相互指点,共同进步

2014-10-21

linux内核编译,国嵌PPT图片

关于国嵌linux内核讲解班的ppt图片截图资源,开发板平台是S3c2410,欢迎大家一起学习arm

2014-10-17

surf图像算法

关于图像处理的经典算法,对学习数字水印技术的同学的最基础需要掌握的算法,surf算法

2014-02-28

C大纲,C语言学习基础

C语言基础,带你进入C语言世界,想学好C语言就可以从这里开始,简单清楚的讲解和经典例程,是学好C语言的好帮手。

2011-10-07

空空如也

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

TA关注的人

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