楼主: adlxk
跳转到指定楼层
上一主题 下一主题
收起左侧

[找工就业] 求问Twitter online coding test

🔗
 楼主| adlxk 2014-1-10 01:01:59 | 只看该作者
全局:
Twitter也没说不能透题,就直接贴题目吧,两道题60min,都不难。Codility提供的demo做完会生成一个score report,但twitter的最后好像直接提交就完了,也没啥feedback。
. .и
Problem 1:
                The first one is to detect the a number in an int array which is not paired with other numbers.
                For example, [1,1,3,4,3], the function should return 4.
.google  и
Problem 2:
                A non-empty zero-indexed array A consisting of N integers is given.
                A pair of integers (P, Q) is calledK-complementary in array A if 0 ≤ P, Q < N and A[P] + A[Q] = K.
                ..
                For example, consider array A such that:
               
                  A[0] =  1  A[1] = 8  A[2]= -3
                  A[3] =  0  A[4] = 1  A[5]=  3
                  A[6] = -2  A[7] = 4  A[8]=  5
                  
                The following pairs are 6-complementary in array A: (0,8), (1,6), (4,8), (5,5), (6,1), (8,0), (8,4).
                For instance, the pair (4,8) is 6-complementary because A[4] + A[8] = 1 + 5 = 6.. 1point3acres
               
                Write a function:. From 1point 3acres bbs
               
                        class Solution { public int solution(int K, int[] A); }
                       
                that, given an integer K and a non-empty zero-indexed array A consisting of N integers,
                returns the number of K-complementary pairs in array A.. 1point3acres
               
                For example, given K = 6 and array A such that:. .и
               
                  A[0] =  1  A[1] = 8  A[2]= -3
                  A[3] =  0  A[4] = 1  A[5]=  3. 1point3acres
                  A[6] = -2  A[7] = 4  A[8]=  5
                  
                the function should return 7, as explained above.
               
                Assume that:
                        N is an integer within the range [1..50,000];.
                        K is an integer within the range [−2,147,483,648..2,147,483,647];
                        each element of array A is an integer within the range [−2,147,483,648..2,147,483,647].-baidu 1point3acres
                       
                Complexity:
                        expected worst-case time complexity is O(N*log(N));
                        expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments).
                       
                Elements of input arrays can be modified.
回复

使用道具 举报

🔗
gloriaxu 2014-1-10 01:48:24 | 只看该作者
全局:
挺简单的~就是一般的在线代码题
回复

使用道具 举报

🔗
lily262519 2014-1-10 16:39:48 | 只看该作者
全局:
adlxk 发表于 2013-11-4 14:10
我就是官网投的SDE Vancouver,没找人refer,周围有几个朋友先投的三藩的那个entry level也是很快就rej了 ...
. .и
咦Vancouver?楼主是加村的?Twitter这个分部好像不招entry-level吧 楼主有过工作经验?
回复

使用道具 举报

🔗
lastquarter 2014-2-2 14:01:16 | 只看该作者
全局:
gloriaxu 发表于 2014-1-10 01:48
挺简单的~就是一般的在线代码题
. ----
你好。可不可以问一下这online coding 的面经呢~
回复

使用道具 举报

🔗
gf1748 2014-2-3 11:17:00 | 只看该作者
全局:
lastquarter 发表于 2014-2-2 14:01
你好。可不可以问一下这online coding 的面经呢~

与leetcode的single number和3Sum很类似
回复

使用道具 举报

🔗
lastquarter 2014-2-6 03:05:54 | 只看该作者
全局:
gf1748 发表于 2014-2-3 11:17
与leetcode的single number和3Sum很类似

谢谢!已经面完了!不过好像不太一样。但是还是谢谢·~
回复

使用道具 举报

🔗
sumingche 2014-2-16 02:48:57 | 只看该作者
全局:
adlxk 发表于 2014-1-9 12:01
Twitter也没说不能透题,就直接贴题目吧,两道题60min,都不难。Codility提供的demo做完会生成一个score re ...

两道 不就是leetcode的 two sum 和 single number I 吧
回复

使用道具 举报

🔗
 楼主| adlxk 2014-2-16 03:15:03 | 只看该作者
全局:
sumingche 发表于 2014-2-16 02:48
两道 不就是leetcode的 two sum 和 single number I 吧

第二题和leetcode two sum不太一样,思路差不多,但它要count所有可能的pair, 允许重复,而且一个elem自己加自己也可以
回复

使用道具 举报

🔗
CooLife 2014-2-16 04:04:48 | 只看该作者
全局:
楼主是在美帝还是加国?
回复

使用道具 举报

🔗
 楼主| adlxk 2014-2-16 07:17:20 | 只看该作者
全局:
CooLife 发表于 2014-2-16 04:04 . Waral dи,
楼主是在美帝还是加国?
. Χ
是在加国。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表