【题目】
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 (can be none) of the characters without disturbing the relati...
分类:
其他好文 时间:
2014-06-29 07:27:17
阅读次数:
210
题目
Write a function to find the longest common prefix string amongst an array of strings.
原题链接
解题思想
给一个字符串数组,求这些字符串的最长公共前缀。
这个题应该是比较简单的,直接写代码,一次AC。解题思想是依次对数组中的字符串求最长公共前缀。
代码实现
class Sol...
分类:
其他好文 时间:
2014-06-20 12:25:09
阅读次数:
247
【题目】
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ 4 8
/ / 11 13 4
...
分类:
其他好文 时间:
2014-06-20 10:53:08
阅读次数:
181
记录一下最近面试的时候遇见的几个问题,反思总结,方便下次面试:先看下北京宇信易诚网络技术经常考的几个问题吧:一.面试试题背景内容报文格式定义如下:20字符长的姓名+1字符长的性别+3字符长的年龄姓名长度不足20的右边补空格 性别中0表示男,1表示女年龄不足3字符的左边补0如:denny 0026这一段报文解析后表示姓名为denny性别为男,年龄为26数据库表结构如下:create tabl...
分类:
编程语言 时间:
2014-06-20 10:05:56
阅读次数:
347
数组含有n个数,其中有一个数只出现1次,其余的数都出现两次,求只出现一次的数。 这个主要考察的是位运算中的异或运算的性质-----当两个相等的数做异或运算他们的值为0(a^a = 0)。本题中对数组中所有的数做异或,那么最后异或的结果就是只出现1次的数。思想很简单代码如下:...
分类:
其他好文 时间:
2014-06-20 10:02:03
阅读次数:
281
设计一个支持‘.' 和 '*' 的正则表达式匹配算法。
这个题复杂的地方在于对于 '*' 的处理,这个符号在正则表达式中被称为贪婪型的量词。这个量词在实际匹配过程中也是尽可能多的匹配直到词尾或者不匹配成功才结束,然后如果其后面还有没有匹配的,则回退到合适的位置,然后才进行下一个匹配。正则表达式中的匹配优先与回溯大概也就是这个意思。关于正则表达式这方面的知识,有兴趣可以读读《精通正则表达式》的第4章表达式的匹配原理。
回到本题,正因为 '*'的特殊性,我们在分类的时候选择根据 '*' 来进行,分类后其子问题也...
分类:
其他好文 时间:
2014-06-20 09:40:42
阅读次数:
207
【题目】
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be...
分类:
其他好文 时间:
2014-06-07 14:28:36
阅读次数:
215
function parse()
{
}
完成parse()函数的内容,要求能够弹出对话框提示当前选中的是第几个单选框。
答案
function parse()
{
var content =...
分类:
Web程序 时间:
2014-06-07 11:38:16
阅读次数:
213
【题目】
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
2
3
4
\...
分类:
其他好文 时间:
2014-06-07 11:37:00
阅读次数:
153
前言题目有点大,其实也就是手痒。。。跟大家来扯一下javascript编译过程。那么到底什么是“编译”呢这个。。。本人文笔太差,我还是直接举例子吧。相信玩过js童鞋应该都看过下面这样一个面试题:
var a=3; function fn(){ ...
分类:
编程语言 时间:
2014-06-07 09:28:42
阅读次数:
325