摘要: 题目描述: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 ... 阅读全文
posted @ 2015-02-05 10:37 Sawyer Ford 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding elemen... 阅读全文
posted @ 2015-02-02 10:36 Sawyer Ford 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Determine whether an integer is a palindrome. Do this without extra space.solution1: //依次比较高位和低位数字是否相同bool isPalindrome(int x) { if(x... 阅读全文
posted @ 2015-01-16 10:05 Sawyer Ford 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 最近在接触软件注册模块,需要获取硬盘序列号来生成注册码。 硬盘序列号,英文名:Hard Disk Serial Number,该号是硬盘厂家为区别产品而设置的,是唯一的。网上搜索一下,发现获取硬盘序列号的代码遍地都是,但很多是错误的。典型代表就是使用GetVolumeInformation函数获取序 阅读全文
posted @ 2015-01-12 18:58 Sawyer Ford 阅读(8435) 评论(1) 推荐(1) 编辑
摘要: 题目描述:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see be... 阅读全文
posted @ 2014-12-28 16:49 Sawyer Ford 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目摘要:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 这道题不算难,主要是要考虑"反转后的值可能越界"这一种情况。(此题起初设计时,未考虑这种情况,因此网上很多旧... 阅读全文
posted @ 2014-12-22 11:28 Sawyer Ford 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目描述:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed ... 阅读全文
posted @ 2014-12-19 19:54 Sawyer Ford 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目描述: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 l... 阅读全文
posted @ 2014-12-17 15:26 Sawyer Ford 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 使用递归可以非常方便地实现二叉树的遍历。如果不使用递归呢,请听我一一道来。首先给出二叉树遍历的递归版本:struct BTNode { char data; BTNode *lchild, *rchild;};void visit(BTNode *p){ coutdatalch... 阅读全文
posted @ 2014-12-12 19:55 Sawyer Ford 阅读(523) 评论(0) 推荐(0) 编辑
摘要: 题目描述:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a si... 阅读全文
posted @ 2014-12-11 14:37 Sawyer Ford 阅读(172) 评论(0) 推荐(0) 编辑