![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
面经
文章平均质量分 67
LBY找工作
这个作者很懒,什么都没留下…
展开
-
通过一道面试题对于BFS,DFS的简单思考
Topic:面经题目:给定一个二维数组,可以看做其中的1被0包围,求数组中有几堆1?Code:class Test{ public static void main(String[] args){ int[][] matrix = { {1, 1, 0, 1}, {0, 1, 1, 0}, {0, 0, 0, 1}, {0, 1, 1,原创 2013-08-24 14:06:56 · 437 阅读 · 0 评论 -
检查一个数是否是2的幂
主题:面经题目:Check a number whether is Power of 2.Code:小结:原创 2013-08-17 14:17:25 · 310 阅读 · 0 评论 -
时针分针角度
主题:面经题目:In a clock, calculate the angle between hour and minute handle Code:class Test{ public static void main(String[] args){ Solution sol = new Solution(); int h = 6, min = 45原创 2013-08-17 02:45:55 · 319 阅读 · 0 评论 -
求数组中唯一奇数次出现的数
主题:面经题目:An array of integers, only one integer appears odd times, all others appear even times, find itCode:import java.util.*;class Test{ public static void main(String[] args){原创 2013-08-17 13:38:19 · 369 阅读 · 0 评论 -
Check If Singly List Is Circular
主题:面经题目:Given a singly list. Check if it is circular.Code:import java.util.*;class Test{ public static void main(String[] args){ Node n1 = new Node(1); Node n2 = new Node(2); N原创 2013-08-17 14:10:26 · 315 阅读 · 0 评论 -
题目待解决
1) System Design question . Implement "File" java class. He went deep in to the design specifics , asked me to design cache , handle parallel access , efficient data structures to do it etc..,2)原创 2013-08-16 02:38:13 · 351 阅读 · 0 评论 -
Suffix Tree的简单构造法(P.S. strStr()的suffix解法)
这里介绍的实现方法是O(N*N)的,目前广泛流行的是O(N)的实现方法,但是由于结构复杂,超出了我目前的实力范围,因此只求把O(N*N)的展示明白就OK了,好吧。Suffix Tree实现代码:原创 2013-08-31 03:07:04 · 470 阅读 · 0 评论 -
Expression Tree的结构实现及面试题举例:计算字符串算术表达式的结果
Expression Tree的Java实现代码:原创 2013-08-31 07:05:56 · 465 阅读 · 0 评论 -
字典找单词路径的更新版
题目在leetcode上和白书(18-10)上都出现过,不再赘述。为什么还要再拿出来写一遍?以前做leetcode的解法只要求返回总共需要的步数,最近看了白书,发现只要在里面加入一个backtracking的map结构,就可以返回单词变化路径的list。Java解法如下:class Test{ public static void main(String[] args)原创 2013-09-02 06:46:59 · 326 阅读 · 0 评论 -
Interleaving String的解析
Interleaving String的两种面试题:1. 给定两个String, 求出所有interleaving string的可能2. 给定两个String,判断第三个String是不是他们的interleaving string第一感觉必然是递归,但是two pointer和permutation的思路还是一闪而过。 Two Pointer是对的,但是permutatio原创 2013-09-13 05:59:19 · 488 阅读 · 1 评论 -
面经:求给定范围的数组中有重复的单个元素
主题:面经题目:An array of integer of size N, all the elements are from range[1,N-1], one is duplicate, find it.代码:import java.util.*;class Test{ public static void main(String[] args){ S原创 2013-08-16 08:22:17 · 307 阅读 · 0 评论 -
面经:复制多指针链表
主题:面经Question:Given a list of nodes , Node class has fields value(of type integer) , next(of type Node) , other(of type Node) where next points to next node and other points to some arbitrary no原创 2013-08-16 05:20:11 · 343 阅读 · 0 评论 -
Pattern Matching
主题:面经题目:Pattern Matching, if '.' is used as a wildcard, which means '.'can represent any character. Code:原创 2013-08-16 13:37:31 · 296 阅读 · 0 评论 -
Convert Binary Tree into Doubly Linked List
Topic:面经题目:Convert Binary Tree into Doubly Linked List.Code:class Solution{ //level-order编排doubly linked list public void levelList(Node root){ if(root==null) return; Queue q = new原创 2013-08-24 12:27:16 · 397 阅读 · 0 评论 -
Leetcode&面经之Minimum Window Substring
Topic:面经题目:leetcode上的原题是: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原创 2013-08-15 07:02:27 · 422 阅读 · 0 评论 -
Recursive之String Parsing(Trie的运用之一)
Topic:面经题目:原创 2013-08-25 13:57:48 · 350 阅读 · 0 评论 -
计算一个范围内2出现的次数
Topic:面经题目:Write a method to count the number of 2s between 0 and n. (cc150: 18-4)Code:原创 2013-08-27 01:44:28 · 541 阅读 · 0 评论 -
Lowest Common Ancestor of two nodes in a binary tree
Question:Find out the Lowest Common Ancestor of two nodes in a Binary Tree.分析:原创 2013-08-15 14:55:10 · 377 阅读 · 0 评论 -
Longest Common Subsequence
主题:面经Question:Find the longest common sub-sequence in two strings, and return its length.分析:youtube上三哥的视频做的不错,讲解清晰。这道题可以用递归,可以用DP。思想相差不多,base case是有一个string遍历到无,返回零;其他情况有,当前遍历位置两个字符串char原创 2013-08-16 02:27:17 · 366 阅读 · 0 评论 -
面经:求给定范围数组中缺少的单个元素
主题:面经题目:An array of integer of size N-1, all the elements are from range[1,N], one is missing, find it.代码:import java.util.*;class Test{ public static void main(String[] args){ S原创 2013-08-16 08:08:16 · 325 阅读 · 0 评论 -
面经:给定数组找出两个数的和为定值的元素
主题:面经题目原创 2013-08-16 09:01:14 · 418 阅读 · 0 评论 -
Check if it's BST
主题:面经题目:Check whether a binary tree is BST(if the binary tree is very large, you can not simply in-order print all the nodes out.) Code:class Solution{ public boolean isBST(Node root, N原创 2013-08-16 13:35:17 · 332 阅读 · 0 评论 -
面试整理
面试整理来自同学互荐和各大知名网站。1. Count Inversion in an array2.原创 2013-07-26 00:18:18 · 636 阅读 · 0 评论