Fork me on GitHub
摘要: 0. 前言 春节这几天每天吃吃喝喝睡睡玩玩,突然发现明天就要上班了,吓得我虎躯一震。 春节结束之后,学生党们陆续开学,相信有许多同学马上就要在春季招聘中拼杀一番。想要收获心意的offer,当然免不了对笔试和面试的充足准备。对于软件开发行业来说,算法题常常会被面试官用来考察学生的基本功是否扎实。为了做 阅读全文
posted @ 2018-02-21 17:13 __Neo 阅读(10665) 评论(1) 推荐(3) 编辑
摘要: 关于二叉树的遍历在面试时是企业经常容易考到的题目,这里做一下总结。 各类二叉树遍历的概念 二叉树有前序遍历,中序遍历和后序遍历三种。关于这三种遍历,网上资料有很多,在此就不做详细介绍了。主要需要记住顺序: 前序遍历 - 根->左->右 中序遍历 - 左->根->右 后序遍历 - 左->右->根 递归 阅读全文
posted @ 2016-04-15 10:50 __Neo 阅读(17277) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) is defined as the sum of the 阅读全文
posted @ 2016-04-13 20:03 __Neo 阅读(1695) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible represen 阅读全文
posted @ 2016-04-12 16:35 __Neo 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2016-04-08 14:11 __Neo 阅读(817) 评论(0) 推荐(0) 编辑
摘要: 近日参加了一家国内某知名互联网公司的在线笔试,有一道算法题比较有意思,拿出来分享一下。 题目: 给定一个字符串,可以随意删除字符串里的任何字符(也可以不删除),目标是删除一些字符后让剩下的字符能够组成回文,并返回该输入字符串所能构成的最长回文长度。 例如,输入:"eabbfa"。 删除e和f后,构成 阅读全文
posted @ 2016-04-04 11:35 __Neo 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums 阅读全文
posted @ 2016-04-02 14:02 __Neo 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains 阅读全文
posted @ 2016-04-01 15:00 __Neo 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 题目: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded me 阅读全文
posted @ 2016-03-30 21:22 __Neo 阅读(912) 评论(0) 推荐(0) 编辑
摘要: 题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2, 阅读全文
posted @ 2016-03-28 14:57 __Neo 阅读(185) 评论(0) 推荐(0) 编辑