- 博客(38)
- 资源 (36)
- 论坛 (2)
- 问答 (1)
- 收藏
- 关注
原创 LeetCode(131)Palindrome Partitioning
题目Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [
2015-12-28 13:42:37
1623
原创 基本套接字编程(7) -- udp篇
1. UDP概述UDP 是User Datagram Protocol的简称, 中文名是用户数据报协议,是OSI(Open System Interconnection,开放式系统互联) 参考模型中一种无连接的传输层协议,提供面向事务的简单不可靠信息传送服务,IETF RFC 768是UDP的正式规范。UDP在IP报文的协议号是17。UDP协议全称是用户数据报协议 ,在网络中它与TCP协议
2015-12-28 11:41:15
1270
原创 LeetCode(124) Binary Tree Maximum Path Sum
题目Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connectio
2015-12-27 16:20:25
3634
2
原创 LeetCode(115) Distinct Subsequences
题目Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (ca
2015-12-26 14:36:37
2818
1
原创 LeetCode(97) Interleaving String
题目Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbac
2015-12-26 13:57:06
666
原创 基本套接字编程(6) -- 线程篇
1. 线程传统Unix模型中,当一个进程需要另一个实体来完成某事,它就fork一个子进程来处理。Unix上大多数网络服务器程序便是以创建多个子进程的方式实现的:父进程accept一个连接,fork一个子进程,该子进程处理与该连接对端的客户之间的通信。尽管,这种范式多年来一直用的不错,但是fork调用依然存在一些问题:(1)fork是昂贵的,fork要把父进程的内存影像复制到子进程,并在
2015-12-23 19:43:48
769
原创 基本套接字编程(3) -- select篇
1. I/O复用我们学习了I/o复用的基本知识,了解到目前支持I/O复用的系统调用有select、pselect、poll、epoll。而epoll技术以其独特的优势被越来越多的应用到各大企业服务器。(后面将有poll & epoll单独学习笔记)基本概念IO多路复用是指内核一旦发现进程指定的一个或者多个IO条件准备读取,它就通知该进程。IO多路复用适用如下场合:
2015-12-23 17:15:54
3038
原创 基本套接字编程(2) -- I/O模型篇
1. I/O模型简介最近一直在学习Unix网络编程,被Unix下各种I/O模型搞得头昏脑涨,结合《Unix网络编程 - 卷一》第六章 并参考了网上各牛们的分析,稍稍厘清了一些。因此记录下来,方便以后复习!
2015-12-23 16:51:48
796
原创 基本套接字编程(1) -- tcp篇
Socket简介Socket是进程通讯的一种方式,即调用这个网络库的一些API函数实现分布在不同主机的相关进程之间的数据交换。几个定义:(1)IP地址:即依照TCP/IP协议分配给本地主机的网络地址,两个进程要通讯,任一进程首先要知道通讯对方的位置,即对方的IP。(2)端口号:用来辨别本地通讯进程,一个本地的进程在通讯时均会占用一个端口号,不同的进程端口号不同,因此在通
2015-12-23 15:24:50
10798
6
原创 LeetCode(93) Restore IP Addresses
题目Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given “25525511135”,return [“255.255.11.135”, “255.255.111.35”]. (Order does no
2015-12-22 15:39:45
594
原创 Linux聊天室项目 -- ChatRome(select实现)
序项目简介:采用I/O复用技术select实现socket通信,采用多线程负责每个客户操作处理,完成Linux下的多客户聊天室!OS:Ubuntu 15.04IDE:vim gcc makeDB:Sqlite 3Time:2015-12-09 ~ 2012-12-21项目功能架构:采用client/server结构;给出客户操作主界面(注册、登录、帮助和退出)、登录后主界面(查看在线列表、私聊、
2015-12-22 11:39:08
5079
18
原创 LeetCode(84) Largest Rectangle in Histogram
题目Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of each
2015-12-21 15:34:05
2282
原创 LeetCode(76) Minimum Window Substring
题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC” Minimum window is “BANC”.Note
2015-12-21 13:09:43
683
原创 LeetCode(68) Text Justification
题目Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that is,
2015-12-16 17:28:22
587
原创 LeetCode(44) Wildcard Matching
题目Implement wildcard pattern matching with support for ‘?’ and ‘*’.‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching should cover the
2015-12-15 14:51:07
551
原创 LeetCode(23)Merge k Sorted Lists
题目Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析合并k个有序链表。我们从数据结构的链表章节学会了如何合并两个链表,针对此题,一个简单的解法便是遍历k次,两个链表合并,合并后的结果与下一个链表合并; 此时时间复杂度为O(nk),遗憾,提交会出现T
2015-12-15 13:44:23
450
原创 LeetCode(5)Longest Palindromic Substring
题目Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.分析求给定字符串的最长回文子串。这道题有下面三种解
2015-12-14 13:51:27
413
原创 LeetCode(307) Range Sum Query - Mutable
题目Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at index i to val. Example: Gi
2015-12-12 17:21:23
3671
原创 LeetCode(306) Additive Number
题目Additive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number in the se
2015-12-12 16:56:33
2219
原创 LeetCode(224) Basic Calculator
题目Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spa
2015-12-09 14:00:30
950
原创 LeetCode(215) Kth Largest Element in an Array
题目Find 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, Given [3,2,1,5,6,4] and k = 2, return 5.Note
2015-12-08 13:54:20
955
原创 LeetCode(225) Implement Stack using Queues
题目Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. empty() – Return wheth
2015-12-08 13:15:27
813
原创 LeetCode(166) Fraction to Recurring Decimal
题目Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For ex
2015-12-07 15:02:02
1496
原创 LeetCode(173) Binary Search Tree Iterator
题目Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and ha
2015-12-07 13:22:53
697
原创 LeetCode(164)Maximum Gap
题目Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements.You ma
2015-12-07 13:08:17
934
原创 LeetCode(165) Compare Version Numbers
题目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 con
2015-12-05 15:16:08
1115
3
原创 LeetCode(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 that ca
2015-12-05 14:08:31
591
原创 LeetCode(168) Excel Sheet Column Title
题目#Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB Credits: Special thanks to @ifanchu for a
2015-12-05 13:38:46
676
原创 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, col2). Range Sum Query 2D The above rectang
2015-12-04 14:22:11
2379
原创 LeetCode(303)Range Sum Query - Immutable
题目Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRange(0, 5)
2015-12-04 13:31:02
4739
原创 LeetCode(234) Palindrome Linked List
题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?分析判断一个链表是否为回文。要求时间复杂度O(n) 空间复杂度O(1)若是可用辅助空间,则其是一个简单的题目,我们可用利用一个辅助数组存储节点元素val值,然后判断数
2015-12-03 13:30:43
731
原创 LeetCode(226)Invert Binary Tree
题目分析交换二叉树的左右子树。递归非递归两种方法实现。AC代码class Solution {public: //递归实现 TreeNode* invertTree(TreeNode* root) { if (!root) return root; TreeNode *tmp = root->left; root
2015-12-03 12:59:31
1115
原创 LeetCode(226)Invert Binary Tree
题目分析交换二叉树的左右子树。递归非递归两种方法实现。AC代码class Solution {public: //递归实现 TreeNode* invertTree(TreeNode* root) { if (!root) return root; TreeNode *tmp = root->left; root
2015-12-03 12:58:06
411
原创 LeetCode(217)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 if every element i
2015-12-03 12:46:45
512
原创 LeetCode(258) Add Digits
题目Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit,
2015-12-02 15:06:35
585
原创 LeetCode(260) Single Number III
题目Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums = [1
2015-12-02 14:41:41
1269
2
C++ MFC实现飞机大战游戏
2012-12-04
Windows下Lex与Yacc配置必备工具
2015-01-22
java 绘图板程序
2012-12-31
C语言桌面万年历
2012-12-04
Linux聊天室 -- select && 多线程实现
2015-12-22
java+jsp+tomcat学生管理系统
2013-01-01
适配器模式(Adepter)C#实现及案例
2013-02-04
lex与Yacc所需flex.exe bison.exe
2015-01-09
各种排序的C++算法实现(插入排序、合并排序、堆排序、快速排序)
2013-01-29
Web服务器的java实现
2013-02-15
MinGW开发工具
2015-01-09
逆風的薔薇的留言板
发表于 2020-01-02 最后回复 2020-01-02
C语言实现桌面万年历
发表于 2012-11-05 最后回复 2012-11-05
Ubuntu 15.04 qtcreator打不开,请问有人遇到过吗?
2015-10-16
TA创建的收藏夹 TA关注的收藏夹
TA关注的人 TA的粉丝