facebook面试题【转】
1. 给两个类A和B
class A {
public void foo (A a) {
...
}
}
class B extends A {
public void foo (B b) {
...
}
}
问这么写会不会有问题
如果是c++,在B类里面foo(A*a)这个函数是不可见的。也就是说 B b; A a; b.foo(&A);会报错。
2. 关于Database的题,假如你执行
select * from employee
employee是一个table
但是返回错误说,这个table不存在什么的,但是现在已知存在这个table,问你可能是
什么原因。
权限问题。不同用户创建的。通过grant usage可以限制某个表对该用户可见。
mysql> GRANT USAGE ON `sharewe`.wp_users TO 'xxj'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
3. 一种字母游戏这样的
给定四个位置 _,_,_,_
然后每个位置可以选5个candidates,然后问这些candidates最多可以组成多少个有效
的词,字典是给定的。
比如,
如果字典是 [cake, bike, fake]
我们可以这样选candidates
第一个位置可以选 b,c,f,e,d
第二个位置 i,a,o,p,e
第三个位置 k,m,w,q,a
第四个位置 e,g,h,k,l
那这些可以组成3个有效的词 cake, bike, fake.
但是如果,这样选每个位置的candidates
第一个位置可以选 z,c,v,b,y
第二个位置 i,a,o,p,e
第三个位置 k,m,w,q,a
第四个位置 e,g,h,k,l
只能组成一个有效的词就是bike.
这样就是第一种选candidates的方法比较好。
然后问你怎么选每个位置的candidates,最终可以让能组成的词最多。
http://www.mitbbs.com/article_t/JobHunting/32739945.html
facebook面试题【转】的更多相关文章
- [LeetCode][Facebook面试题] 通配符匹配和正则表达式匹配,题 Wildcard Matching
开篇 通常的匹配分为两类,一种是正则表达式匹配,pattern包含一些关键字,比如'*'的用法是紧跟在pattern的某个字符后,表示这个字符可以出现任意多次(包括0次). 另一种是通配符匹配,我们在 ...
- Careercup - Facebook面试题 - 6026101998485504
2014-05-02 10:47 题目链接 原题: Given an unordered array of positive integers, create an algorithm that ma ...
- Careercup - Facebook面试题 - 5344154741637120
2014-05-02 10:40 题目链接 原题: Sink Zero in Binary Tree. Swap zero value of a node with non-zero value of ...
- Careercup - Facebook面试题 - 5765850736885760
2014-05-02 10:07 题目链接 原题: Mapping ' = 'A','B','C' ' = 'D','E','F' ... ' = input: output :ouput = [AA ...
- Careercup - Facebook面试题 - 5733320654585856
2014-05-02 09:59 题目链接 原题: Group Anagrams input = ["star, astr, car, rac, st"] output = [[& ...
- Careercup - Facebook面试题 - 4892713614835712
2014-05-02 09:54 题目链接 原题: You have two numbers decomposed in binary representation, write a function ...
- Careercup - Facebook面试题 - 6321181669982208
2014-05-02 09:40 题目链接 原题: Given a number N, write a program that returns all possible combinations o ...
- Careercup - Facebook面试题 - 5177378863054848
2014-05-02 08:29 题目链接 原题: Write a function for retrieving the total number of substring palindromes. ...
- Careercup - Facebook面试题 - 4907555595747328
2014-05-02 07:49 题目链接 原题: Given a set of n points (coordinate in 2d plane) within a rectangular spac ...
- Careercup - Facebook面试题 - 5435439490007040
2014-05-02 07:37 题目链接 原题: // merge sorted arrays 'a' and 'b', each with 'length' elements, // in-pla ...
随机推荐
- laravel连接数据库提示mysql_connect() :Connection refused...
在.env配置文件中填写了正确的数据库连接配置的情况下连接还是出错了,明显提示的不是密码错误,那就看看端口吧, DB_HOST=127.0.0.1 DB_PORT= DB_DATABASE=test ...
- GoF23种设计模式之行为型模式之解释器模式
一.概述 给定一种语言和其文法的一种表示,再定义一个解释器,该解释器使用表示来解释语言中的句子. 二.适用性 当需要解释一种语言,并且可以将该语言中的句子表示 ...
- istio的原理和功能介绍
目录 1 什么是Istio 2 架构和原理 2.1 Proxy代理 2.2 Mixer混合器 2.3 Pilot引导 2.4 Citadel堡垒 2.5 Galley 3 功能列表 4 性能评估 1 ...
- InnoDB Redo Flush及脏页刷新机制深入分析
概要: 我们知道InnoDB采用Write Ahead Log策略来防止宕机数据丢失,即事务提交时,先写重做日志,再修改内存数据页,这样就产生了脏页.既然有重做日志保证数据持久性,查询时也可以直接从缓 ...
- luogu3469 [POI2008]BLO-Blockade
#include <iostream> #include <cstring> #include <cstdio> using namespace std; type ...
- 令人惊叹的Visual Studio Code插件
vscode是一款开源且优秀的编辑器,接下来让我吐血推荐一下我工作使用过的令人惊叹的Visual Studio Code插件. 代码编辑插件 vscode-color-highlight ------ ...
- 2.新手必须掌握的Linux命令
第2章 新手必须掌握的Linux命令 章节简述: 本章首先介绍系统内核和Shell终端的关系与作用,然后介绍Bash解释器的4大优势并学习Linux命令的执行方法.经验丰富的运维人员可以通过合理地组合 ...
- tzcacm去年训练的好题的AC代码及题解
A - Tree UVA - 548 You are to determine the value of the leaf node in a given binary tree that is th ...
- PHP杂技(一)
逻辑运算符 &&和& ||和|的部分区别 返回结果类型不同, A||B 如果A为真那么B不会做判断,而A|B前后都做判断 switch判断中并不是===,更像是==,例如(1) ...
- sklearn python API
sklearn python API LinearRegression from sklearn.linear_model import LinearRegression # 线性回归 # modul ...