- 博客(131)
- 资源 (7)
- 问答 (1)
- 收藏
- 关注
原创 程序员智力算法笔试卷
1 10个相同的糖果,分给三个人,每个人至少要得一个。有()种不同分法3334353610个糖果排列好9个空,取两个作为分割点,为36个2 在一个长为33厘米的光滑凹轨上,在第3厘米、第6厘米、第19厘米、第22 厘米、第26厘米处各有一个钢珠,凹轨很细,不能同时通过两个钢珠,开始时,钢珠运动方向是任意的。两个钢珠相撞后,以相同速度反向运动。假设所有钢珠初 始速度为每秒
2015-03-31 13:51:29 1262
原创 人人网2015研发笔试卷B
1 下面的排序算法中,初始数据集的排列顺序对算法的性能无影响的是插入排序堆排序冒泡排序快速排序2 在以下哪个操作中, 数组比链表更快?原地逆序头部插入返回头节点返回随机节点3 假设某个广告展现后被点击的概率是1/3(实际远小于这个数,只是为方便计算),那该广告3次展现,被点击次数少于2次的概率是?0.740.300.260.7
2015-03-31 08:42:55 920
原创 人人网2015研发笔试卷A
1 以下排序中时间复杂度最差的是归并排序选择排序希尔排序堆排序2当参数*x==1, *y==1, *z==1时,下列不可能是函数add的返回值的( )?int add(int *x, int *y, int *z){ *x += *x; *y += *x; *z += *y; return *z; }456
2015-03-30 21:54:09 1535
原创 Number of 1 Bits 数字二进制中1的个数
Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has bi
2015-03-30 21:01:09 449
原创 Reverse Bits 翻转进制位
Reverse Bits Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented i
2015-03-30 20:59:37 475
原创 Rotate Array 数组的旋转
Rotate Array Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as m
2015-03-30 20:58:41 554
原创 Factorial Trailing Zeroes N!末尾0的个数
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @ts fo
2015-03-30 20:58:24 403
原创 Excel Sheet Column Number 进制转换
Excel Sheet Column Number Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1
2015-03-30 20:55:02 415
原创 Majority Element 查找出现一半的数字
Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty
2015-03-30 20:53:44 541
原创 Excel Sheet Column Title 进制转换
Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z
2015-03-30 20:17:27 380
原创 Compare Version Numbers 版本大小比较 字符串处理
Compare Version Numbers Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the vers
2015-03-30 20:16:26 539
原创 Intersection of Two Linked Lists 查找2个链表的公共交点
Intersection of Two Linked Lists Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1
2015-03-30 20:15:04 514
原创 Min Stack 包含最小值的栈实现
Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of t
2015-03-30 20:14:18 477
原创 Valid Palindrome 合法的回文串
Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindr
2015-03-30 20:13:48 379
原创 Pascal's Triangle II 第k个数字的排列 杨辉三角形
Pascal's Triangle II Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k)
2015-03-30 20:09:26 506
原创 Pascal's Triangle 打印数字三角形
Pascal's Triangle Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]
2015-03-30 20:08:15 899
原创 Path Sum 判断二叉树的和 DFS处理
Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below b
2015-03-30 20:07:03 363
原创 Minimum Depth of Binary Tree 二叉树的最小深度
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.
2015-03-30 20:05:58 429
原创 Balanced Binary Tree 平衡二叉树的判断
Balanced Binary Tree Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtr
2015-03-30 20:05:15 567
原创 Binary Tree Level Order Traversal II 从下向上按层遍历二叉树
Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ex
2015-03-30 20:03:48 466
原创 Maximum Depth of Binary Tree 二叉树的最大深度
Maximum Depth of Binary Tree Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
2015-03-30 20:03:42 450
原创 Binary Tree Level Order Traversal 二叉树按层遍历
Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,
2015-03-30 20:02:20 554
原创 Symmetric Tree 判断对称的树
Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4
2015-03-29 21:39:13 476
原创 Same Tree 判断相同的树
Same Tree Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same va
2015-03-29 21:21:16 453
原创 Merge Sorted Array 合并排序的数组
Merge Sorted Array Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hol
2015-03-29 21:19:57 466
原创 Remove Duplicates from Sorted List 去除链表重复数据
Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->
2015-03-29 21:19:39 475
原创 Climbing Stairs 递推上台阶
Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?clas
2015-03-29 21:18:41 573
原创 Add Binary 二进制加法
Add Binary Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".class Solution {public: string addBinary(string a, strin
2015-03-29 21:17:56 562
原创 Length of Last Word 最后个字符长度
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
2015-03-29 21:14:40 462
原创 Count and Say 数字统计
Count and Say The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" o
2015-03-29 21:14:09 412
原创 Valid Sudoku 判断数独的合法性 3个判断
Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
2015-03-29 21:13:12 468
原创 Implement strStr() strncmp实现strstr()
Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signature of the
2015-03-28 13:28:15 532
原创 Remove Element 数组删除指定的元素
Remove Element Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave be
2015-03-28 13:26:42 738
原创 Remove Duplicates from Sorted Array 去除重复的
Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for
2015-03-28 13:24:16 487
原创 Merge Two Sorted Lists 合并链表
Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Definition for
2015-03-28 13:23:22 412
原创 美团2012研发工程师笔试卷
1 k链表翻转。给出一个链表和一个数k,比如链表1→2→3→4→5→6,k=2,则翻转后2→1→4→3→6→5,若k=3,翻转后3→2→1→6→5→4,若k=4,翻转后4→3→2→1→5→6,用程序实现。typedef struct node { struct node *next; int data;} node;void createList(node **head,
2015-03-28 13:22:43 684
原创 京东2013研发笔试卷
1 在京东商城的商品展示页面下方,总会有一些关于本商品的客户评论信息。模仿该评论模块,有如下三个表:price(商品表),userinfo(用户表),threads(评论主题表)1.请画出以上三张表对应实体的ER图(实体字段标明主键外键即可,用箭头表示) 2.在product表中加入一条新纪录(1004,'京东空调',3000).请写出对应的SQL语句。 3.更新product表中pi
2015-03-27 22:10:49 938
原创 小米研发工程师笔试卷A
1两个人,A的速度为a,B的速度为b,在一直路上相向而行。在A、B距离为s的时候,A放出一个鸽子C,速度为c,C飞到B后,立即掉头飞向A,遇到A在掉头飞向B......就这样在AB之间飞来飞去,直到A、B相遇,假设a=40, b=60, c=400, s=100,这期间鸽子共飞行路程为 400// s*c/(a+b)2 he的平方=she。h、e、s代表的数字
2015-03-27 21:13:22 829
原创 百度2011研发工程师笔试卷
1 判断一个括号字符串是否匹配正确,如果括号有多种,怎么做?如(([]))正确,[[(()错误。用栈来出现,凡是左括号就压栈,凡是右括号就出栈,最后如果栈为空就匹配正确2 百度Spider如何在不超过抓取限额的情况下使得抓取的网页价值之和最大,要求一个最佳抓取方案。请详细描述你的算法思路(可以用伪代码),并分析时间复杂度和空间复杂度。3 仅用O(1)的空间,将整
2015-03-27 15:50:08 678
原创 百度2012研发工程师笔试
1用 C 语言写一个函数来执行一串任务。任务是互相依赖的。比如 B 任务依赖 A 任 务,则 A 完成 B 才能执行。不考虑并发限制,假设所有的任务都能一次执行成功, 所有的任务执行时间都相等。任务数据结构原型为:typedef struct { //该任务的 ID int id; //该任务依赖的任务的 ID int *child; //该任务依赖的任
2015-03-27 15:46:05 638
spring mybatis sql语句使用注解描述
2016-10-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人