- 博客(134)
- 资源 (3)
- 收藏
- 关注
原创 [有道2015校招笔试]叠罗汉
题目描述 叠罗汉是指一个人站在另一个人肩膀,要求站在上面的人必须比下面的人个子矮,体重低,现给定一组人的和体重和身高,计算最多可能叠多少人? 例如:(60,154)(55,149)(80,167)(78,180) 输出:3 请自行设计输入输出格式,给出伪代码描述,并分析算法复杂度解题思路
2014-09-28 20:07:52
959
原创 [小米2015校招笔试]多项式乘积
题目描述求两个多项式的乘积 pa=an*x^n + an-1*x^(n-1) + ... + a1*x + a0; pb=bm*x^n + bm-1*x^(n-1) + ... + b1*x + b0;其中,an,an-1...a1,a0,bm,bm-1...b1,b0都是整数,范围是[-1000,1000],0c++: string multipl
2014-09-28 20:00:23
873
原创 [小米2015校招笔试]回文数
题目描述 大家对回文串不陌生吧?一个字符串从前看和从后看如果一样的话,就是回文串,比如“上海自来水来自海上”就是一个回文串。现在我们的问题来了,把一个数字看成字符串,问它是不是一个回文数?时间复杂度和空间复杂度越低的算法,得分越高。c++: bool isPalindromeNumber(long num);java: boolean isPalindromeN
2014-09-28 19:53:33
693
原创 使用栈Stack实现队列Queue
如何只使用stack实现queue呢?由于stack是现进后出(FILO),而queue是先进先出的(FIFO)。也就是说stack进行了一次反向,进行两次反向就能实现queue的功能,所以可以用两个stack实现queue。 假设两个栈A和B,且都为空。可以认为栈A提供入队的功能,栈B提供出队的功能。下面是入队和出队的具体算法:(1)如果栈B不为空,直接弹出
2014-09-26 15:58:56
2568
原创 [LeetCode]Word Break
题目描述Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict
2014-09-21 17:02:41
604
原创 Android自定义控件NumberCircleProgressBar(圆形进度条)的实现
NumberCircleProgressBar是一个基于Android的自定义圆形进度条,提供两种模式(rotate模式和rising_water模式),使用者可以自行定义文字颜色、文字大小、已完成进度的颜色、未完成进度的颜色等多个属性,同时提供了简单的例子以及多个style 以供参考!
2014-09-06 17:32:53
5174
5
原创 [阿里2015校招笔试]求二叉树中相差最大的两个节点间的差值绝对值
直接上代码/** * 按层遍历二叉树,返回这棵二叉树中相差最大的两个节点间的差值绝对值(默认至少有两个节点) * @param root * @return */ public static int getMaxValue(TreeNode root) { Queue queue = new LinkedList();// 队列 TreeNode temp;
2014-08-29 22:16:21
1719
原创 [阿里2015校招笔试]求字符串query和text最长连续字母序列的长度
直接上代码 /** * 求字符串query和text最长连续字母序列的长度 原理: 1.以query.length()和text.length()组成矩阵martix; * 2.矩阵martix[i][j]对应的字符相同,则该节点赋值为1; 3.若当前字符相同节点的值 martix[i][j]= * martix[i-1][j-1] +1,则当前节点的值就是最大公用子串的长
2014-08-29 22:11:44
1056
原创 [LeetCode]Construct Binary Tree from Preorder and Inorder Traversal
题目描述Given preorder and inorder traversal of a tree, construct the binary tree.解题思路代码
2014-07-11 10:15:14
545
原创 [LeetCode]Convert Sorted List to Binary Search Tree
题目描述Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题思路代码
2014-07-10 14:54:24
486
原创 [LeetCode]Minimum Depth of Binary Tree
题目描述Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.求二叉树根节点到叶子jied解题思路
2014-07-10 10:34:16
416
原创 [LeetCode]Palindrome Partitioning II
题目描述Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab
2014-07-09 14:38:20
393
原创 [LeetCode]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 [
2014-07-09 13:00:32
452
原创 [LeetCode]Search a 2D Matrix
题目描述Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integ
2014-07-07 15:22:08
461
原创 [LeetCode]Best Time to Buy and Sell Stock II
题目描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (
2014-06-20 16:59:49
967
Android学习之SlidingMenu实现(向右滑动)
2013-04-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人