input T 1<=T<=10000 n m 1<=n<=2000000007 1<=m<=32 output m个鸡蛋从1到n哪一楼x扔下去刚好没碎,而再x+1楼扔下去就碎了,求最少扔的次数无论x为1到n的哪个数都能确定x 如果x>32,输出Impossible,否则输出x 做法:dp,d(x,y)=d(x,y-1)+d(x-1,y-1),x:egg,y:floor求出下限,即x个鸡蛋至少要试多少次 # include <stdio.h> # in…
有一道 JavaScript 面试题. f = function () { return true; }; g = function () { return false; }; (function() { if (g() && [] == ![]) { f = function () { return false; }; function g() { return true; } } })(); console.info(f()); 首先看前两行 var f = function () {…
2014-05-03 22:10 题目链接 原题: Given a dictionary, and a list of letters ( or consider as a string), find the longest word that only uses letters from the string. [I didn't meet this question, what's the best solution?] 题目:给定一个字符串,和一个字典.从字典中找出一个最长的词,并且这个词…
一道sql面试题(查询语句) id name age 1 a 11 2 b 11 3 c 12 4 d 13 5 e 12 . . . 查询age唯一的那一个 这个应该怎么写 满意答案 热心问友 2010-10-14 select * from table1 where id not in (select age from table1 group by age having count(1)>1) --Up…
1. 原题(同事给的) Max Howell 参加了谷歌的面试,出题人竟然要求 Max Howell 在白板上作出解答,Max Howell 当然愤怒地拒绝了,回家以后马上在微博上跟我们分享他的吐槽: Google: % of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. 看来在白板上作出反转二叉树的解答并不容…
2014-05-08 23:45 题目链接 原题: How would you use Dijkstra's algorithm to solve travel salesman problem, which is to find a shortest path from a starting node back to the starting node and visits all other node exactly once. 题目:如何用Dijkstra算法来解决TSP问题?(谁会出这种…
一道面试题,以下程序的输出是? public class StaticDispatch { static abstract class Human{ } static class Man extends Human{ } static class Woman extends Human{ } public void sayHello(Human guy){ System.out.println("hello , guy!"); } public void sayHello(Man gu…