自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(78)
  • 资源 (2)
  • 收藏
  • 关注

原创 排序算法代码总结

冒泡排序选择排序插入排序快速排序归并排序堆排序希尔排序基数排序排序算法在笔试面试中几乎是必考的,因为它是很多复杂算法的基础,也是我们学习数据结构与算法的入门知识。目前网上介绍各类排序算法的博客和帖子非常多,但其中有不少作者提供的代码有错误或者代码中没有考虑特殊情况。在此,我们再次总结一下常见的八大排序算法,试图讲清楚各个算法的基本原理,并提供java代码以及详细

2016-05-28 13:11:32 2176 2

翻译 Online Object Tracking : A Benchmark 翻译

Online Object Tracking : A Benchmark 翻译 在线目标跟踪:一种评估基准吴毅 Jongwoo Lim 杨明玄 目标跟踪是计算机视觉大量应用中的重要组成部分之一。近年来,尽管在分享源码和数据集方面的努力已经取得了许多进展,开发一套库和标准用于评估当前最先进的跟踪算法仍然是极其重要的。在简单回顾近年来在线目标跟踪的研究进展后,我们以多种评价标准进行了大量的实验,用于研究这些算法的性能

2016-05-11 23:05:29 12157 1

原创 数组与集合的相互转换

在实际开发过程中,为了处理的方便或者接口类型的要求,我们经常需要在集合与数组之间进行相互转换,JDK为我们提供了方便的工具类和相应的方法来完成这个工作。Arrays.asList()方法与Collection.toArray()方法一起充当了基于数组的API与基于 Collection的API之间相互转化的桥梁,但是由于不甚了解其实现的原理,很多同学在使用的过程中经常会被一些问题困扰,在此通过源码解

2016-08-08 16:51:47 1583

原创 正整数的因子与质因子

问题给定一个正整数,求其所有因子与质因子。一个数的自身和1都是其因子; 一个数的因子总是成对出现num=m*n;奇数必定没有偶数因子; 所有质数(除了2)都是奇数;正整数分为质数、合数和1,任一合数必定可以写成若干个质数因子之积(可能会有重复质因子)

2016-08-07 13:02:47 2237

原创 全组合与全排列

问题给定一个字符串或者数组,求其所有子序列字符串(即全部的组合)、列举出字符串所有元素的全排列,并按指定的排序规则输出。分析求排列组合是笔试中常考的经典问题,都可以用循环和递归来实现。这种问题的关键是理解其算法思想和操作技巧,做到不重复且不遗漏地列举出所有的组合模式。本文对上述两个问题分别采用较易理解的循环和递归方式实现,这里需要用到多指标排序,正好也可以练习下其用法。 P.S. 最近阿里内推面试

2016-08-07 11:45:03 874

原创 网易16年研发笔试题 - 扫描透镜

问题在N*M的草地上,提莫种了K个蘑菇,蘑菇爆炸的威力极大,兰博不想贸然去闯,而且蘑菇是隐形的.只 有一种叫做扫描透镜的物品可以扫描出隐形的蘑菇,于是他回了一趟战争学院,买了2个扫描透镜,一个 扫描透镜可以扫描出(3*3)方格中所有的蘑菇,然后兰博就可以清理掉一些隐形的蘑菇. 问:兰博最多可以清理多少个蘑菇?注意:每个方格被扫描一次只能清除掉一个蘑菇。

2016-08-04 19:41:30 1490

原创 网易16年研发笔试题 - 炮台攻击

问题兰博教训提莫之后,然后和提莫讨论起约德尔人,谈起约德尔人,自然少不了一个人,那 就是黑默丁格——约德尔人历史上最伟大的科学家. 提莫说,黑默丁格最近在思考一个问题:黑默丁格有三个炮台,炮台能攻击到距离它R的敌人 (两点之间的距离为两点连续的距离,例如(3,0),(0,4)之间的距离是5),如果一个炮台能攻击 到敌人,那么就会对敌人造成1×的伤害.黑默丁格将三个炮台放在N*M方格中的点上,并且给出

2016-08-04 19:23:55 601

原创 网易16年研发笔试题 - 小易的升级之路

问题小易经常沉迷于网络游戏.有一次,他在玩一个打怪升级的游戏,他的角色的初始能力值为 a.在接下来的一段时间内,他将会依次遇见n个怪物,每个怪物的防御力为b1,b2,b3…bn. 如果遇到的怪物防御力bi小于等于小易的当前能力值c,那么他就能轻松打败怪物,并 且使得自己的能力值增加bi;如果bi大于c,那他也能打败怪物,但他的能力值只能增加bi 与c的最大公约数.那么问题来了,在一系列的锻炼后,小易

2016-08-04 19:03:25 604

原创 网易16年研发实习生笔试题 - 寻找第K大

问题有一个整数数组,请你根据快速排序的思路,找出数组中第K大的数。 给定一个整数数组a,同时给定它的大小n和要找的K(K在1到n之间),请返回第K大的数,保证答案存在。

2016-08-03 20:06:49 1479

原创 网易16年研发实习生笔试题 - 二叉树节点距离

问题有一棵二叉树,树上每个点标有权值,权值各不相同,请设计一个算法算出权值最大的叶节点到权值最小的叶节点的距离。二叉树每条边的距离为1,一个节点经过多少条边到达另一个节点为这两个节点之间的距离。给定二叉树的根节点root,请返回所求距离。JavaCodeimport java.util.ArrayList;import org.junit.Test;public class NodeDistanc

2016-08-03 18:20:48 1067

原创 网易16年研发实习生笔试题 - 比较重量

问题小明陪小红去看钻石,他们从一堆钻石中随机抽取两颗并比较她们的重量。这些钻石的重量各不相同。在他们们比较了一段时间后,它们看中了两颗钻石g1和g2。现在请你根据之前比较的信息判断这两颗钻石的哪颗更重。给定两颗钻石的编号g1,g2,编号从1开始,同时给定关系数组vector,其中元素为一些二元组,第一个元素为一次比较中较重的钻石的编号,第二个元素为较轻的钻石的编号。最后给定之前的比较次数n。请返回这

2016-08-03 16:59:40 539

原创 网易17年内推笔试练习题 - 出专辑

网易,2017年内推笔试练习题,牛客网,出专辑

2016-08-03 10:54:07 593

原创 网易17年内推笔试练习题 - 数字黑洞

网易2017年内推笔试练习题 ,牛客网, 数字黑洞

2016-08-03 10:34:49 568

原创 百度17年暑期实习生笔试题 - 单词接龙

问题拉姆刚开始学习英文单词,对单词排序很感兴趣。 如果给拉姆一组单词,他能够迅速确定是否可以将这些单词排列在一个列表中,使得该列表中任何单词的首字母与前一单词的尾字母相同。 你能编写一个程序来帮助拉姆进行判断吗?输入描述输入包含多组测试数据。 对于每组测试数据,第一行为一个正整数n,代表有n个单词。 然后有n个字符串,代表n个单词。 保证:2<=n<=200,每个单词长度大于1且小于等于1

2016-06-11 20:07:43 3827 11

原创 腾讯17年暑期实习生笔试题 - 有趣的数字

问题小Q今天在上厕所时想到了这个问题:有n个数,两两组成二元组,差最小的有多少对呢?差最大呢?输入描述输入包含多组测试数据。 对于每组测试数据: N - 本组测试数据有n个数 a1,a2…an - 需要计算的数据 保证:1<=N<=100000,0<=ai<=INT_MAX.输出描述对于每组数据,输出两个数,第一个数表示差最小的对数,第二个数表示差最大的对数。

2016-06-11 19:12:42 1523

原创 腾讯17年暑期实习生笔试题 - 字符移位

问题小Q最近遇到了一个难题:把一个字符串的大写字母放到字符串的后面,各个字符的相对位置不变,且不能申请额外的空间。你能帮帮小Q吗?输入描述输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.输出描述对于每组数据,输出移位后的字符串。

2016-06-11 18:32:29 1467

原创 腾讯17年暑期实习生笔试题 - 构造回文

问题给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢?输出需要删除的字符个数。输入描述输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.输出描述对于每组数据,输出一个整数,代表最少需要删除的字符个数。

2016-06-11 18:25:54 797

原创 阿里13年研发笔试题 - 寻找有序数组中元素值等于其下标的所有元素

给定一个升序排列的整型数组A,其元素的值都两两不相等。请设计一高效的算法找出中间所有A[i] = i的下标。 并分析其复杂度。(不分析复杂度不得分)Java Codepublic class FindSubscript { @Test public void test() { int[] nums = new int[]{-2,-1,2,3,4};

2016-05-12 23:03:25 1411

原创 凑硬币

问题现有面额为1元,3元,5元的硬币若干枚,如何用最少的硬币凑够11元?拓展保证各种面额的硬币数足够多,如何用最少的硬币凑够n元?Java Code版本一:递归 求解动态规划问题版本二:递推 求解动态规划问题

2016-05-12 14:13:28 1032

原创 网易实习生笔试题 - 卡密模糊匹配

考拉哥哥搞了一批礼品卡出售,每张礼品卡上有个涂层,用户划开涂层后可以16位的卡密,卡密可用于兑换相应的券。由于在印刷的时候,没有选择合适的字体,导致数字9和字母g看起来一摸一样。此时,后台数据库已对卡密做了三次加密且无法破解,已售出的礼品卡也无法收回了。为了保证礼品卡能正常使用,我们提出如下的解决方案,即对所有的字母g和数字9进行模糊匹配(已验证在该方案下此批次的礼品卡的卡密不会出现重复)。现在

2016-05-12 13:02:00 731

原创 Leetcode - Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.NoteA word is defi

2016-05-05 20:55:58 412

原创 Leetcode - Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.ExampleGiven s = “hello”, return “holle”. Given s = “leetcode”, return “leotcede”. Java Codepublic Strin

2016-05-05 19:10:32 281

原创 Leetcode - Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101]

2016-05-05 19:01:59 329

原创 Leetcode - Bulls and Cows

You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a h

2016-05-05 18:52:11 452

原创 Leetcode - Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will

2016-05-05 18:32:57 442

原创 Leetcode - Word Pattern

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Exa

2016-05-05 18:24:24 349

原创 Leetcode - Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling y

2016-05-05 18:18:32 349

原创 Leetcode - First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based

2016-05-05 16:19:57 320

原创 Leetcode - Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. ExampleGiven num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digi

2016-05-05 16:14:46 276

原创 Leetcode - Binary Tree Paths

Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree:All root-to-leaf paths are: ["1->2->5", "1->3"]Java Code

2016-05-05 14:49:05 268

原创 Leetcode - Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.Examples = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false. NoteYou may assume the st

2016-05-05 14:43:41 322

原创 Leetcode - Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined b

2016-05-05 14:35:40 253

原创 Leetcode - Power of Three

Given an integer, write a function to determine if it is a power of three. Follow upCould you do it without using any loop / recursion? Java Code/*** 版本一:判断因子法* 先找到整数范围内最大的3的幂maxNum,再判断n是否能被m

2016-05-05 10:20:31 263

原创 Leetcode - Power of Two

Given an integer, write a function to determine if it is a power of two. Java Code//版本一:通过整数二进制位中1的个数来判断如果所有二进制位上只有一个1,则n是2的幂。

2016-05-05 10:12:27 256

原创 Leetcode - Invert Binary Tree

Invert a binary tree. This problem was inspired by this original tweet by Max Howell: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so

2016-05-04 22:27:47 347

原创 Leetcode - Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the total are

2016-05-04 22:14:01 412

原创 Leetcode - Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k. Ja

2016-05-04 22:09:29 288

原创 Leetcode - Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every ele

2016-05-04 22:06:29 308

原创 Leetcode - Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with anoth

2016-05-04 21:57:48 485

原创 Leetcode - Happy Number

Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squa

2016-05-04 21:51:50 367

Spring Framework API 2.5

Spring 2.5的英文API文档,类似于jdk的API文档格式,包括各个Packages的导航和对应的Classes的导航,分类清晰,方便查阅。

2016-06-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除