- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 10 Regular Expression Matching解题思路
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
2019-01-25 14:15:34 241
原创 LeetCode 44. Wildcard Matching解题思路
题目意思为s为源字符串,p为带有通配符的匹配字符串,其中?带表一个字符,而*可代表空或是任一子串,?比较好处理,但是*可代表空或是任一子串,因此不好从头到尾一个字节一个字节比较,这里考虑采用动态规划的方式来处理。分为以下几种情况处理:1. s为#####a, p为#####a,那么直接将s和p中的最后一个字符去掉,s[0:i-1]和p[0:j-1]2. s为#####a, p为####...
2019-01-24 14:46:40 141
原创 LeetCode 51 N-Queens 解题报告
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Ea...
2019-01-22 15:06:37 127
原创 LeetCode 632. Smallest Range解题思路
题目如下:You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists.We define the range [a,b] is smaller than range [c,...
2019-01-03 13:24:06 165
原创 关于recvfrom使用过程中的一个坑点
问题描述首先对于recvfrom的原型如下:ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);返回值为读取到的字节长度,这里有一个坑点,我们在接收时需要传入一个buffer用于拷贝接收到的数据,传入参数包括buffer的...
2018-12-25 15:17:04 17605
原创 sockaddr_in与sockaddr区别
使用socket编程以来一直没弄清楚这两个数据结构有什么区别,今天突然想弄清楚这两个数据结构到底有什么差别,找了LINUX下的几个头文件,终于弄清楚了,看来某位大神说的不错,源码面前无密码可言。直接上代码,这里把相关的定义全部集中到一起,方便理解:typedef unsigned short int sa_family_t; #define __SOCKADDR_COMMON(sa_prefi
2017-06-22 11:09:06 313
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人