《数据科学面试40+真题讲解》,K神本年度最后一次开课


一亩三分地论坛

 找回密码
 Sign Up 注册获取更多干货
码农求职神器Triplebyte:
不用海投,内推你去多家公司面试
Airbnb 数据科学职位
in analytics and inference
天天打游戏、照样领工资,
你要不要来?
把贵司招聘信息放这里
查看: 839|回复: 4
收起左侧

特斯拉 电面 OA

[复制链接] |试试Instant~ |关注本帖
洋葱头 发表于 2017-7-12 16:07:40 | 显示全部楼层 |阅读模式

2017(7-9月) 码农类 硕士 全职@ - 网上海投 - 技术电面 |Fail在职跳槽

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看,没有帐号?Sign Up 注册获取更多干货

x
最近投了特斯拉,有两个组联系,一个是做power的simulator,一个是QA的
power的只做了OA,给了三个小时的时间,要求完成一个client/server message的程序,里面用到了C++的jason API. 鍥磋鎴戜滑@1point 3 acres
因为他们现在C++的系统还没搭建起来,就直接把题目发给我了。最近比较忙拖了好久才做。
按照要求写好了,发过去,不过对方不满意。也就算了

还有一个QA组,先给了一个OA。要求用python 写几个unit test case。几分钟就可以搞定的。
. From 1point 3acres bbs电面的问题也不难。记得就是把0移动到后面的程序。
还有让写一个斐波那契的递归。要求用C++的template写。。。 很诡异的问题. 鍥磋鎴戜滑@1point 3 acres
template<size_t n>
int fib(){
    return fib<n-1>() + fib<n-2>();
}. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴

template<>
int fib<0>(){
    return 0;
}

template<>. 1point3acres.com/bbs
int fib<1>(){
    return 1;
-google 1point3acres}. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
.鐣欏璁哄潧-涓浜-涓夊垎鍦
. from: 1point3acres.com/bbs
最后hr说组里面又review 了我的简历,发现不match,也就算了。

有需要的同志可以私信我,我可以吧oa发给你。. 1point3acres.com/bbs
以上就这些,有问题请留言。

各位加油 加油 加油 加油  

攒人品 。。。

. 1point 3acres 璁哄潧
edyyy 发表于 2017-7-13 14:37:20 来自手机 | 显示全部楼层
谢谢楼主 发我一份行吗
回复 支持 反对

使用道具 举报

 楼主| 洋葱头 发表于 2017-7-23 07:10:56 | 显示全部楼层
edyyy 发表于 2017-7-13 14:37
谢谢楼主 发我一份行吗

不好意思 刚看到
我还是把我的答案发到帖子里吧
回复 支持 反对

使用道具 举报

 楼主| 洋葱头 发表于 2017-7-23 07:11:39 | 显示全部楼层
  1. #!/usr/bin/python
  2. """
  3. Module to test function "_is_point_in_poly"..鐣欏璁哄潧-涓浜-涓夊垎鍦
  4. """

  5. from unittest import TestCase


  6. class TestIsPointInPoly(TestCase):. 1point 3acres 璁哄潧
  7.     """
  8.     Unit tests for function "_is_point_in_poly".
  9.     """
  10.     def _is_point_in_poly(self, x, y, poly):
  11.         """
  12.         This is the function we want to test.
  13.         """
  14.         n = len(poly). 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
  15.         inside = False

  16.         p1x, p1y = poly[0]
  17.         for i in range(n+1):
  18.             p2x, p2y = poly[i % n]
  19.             if y > min(p1y, p2y):. visit 1point3acres.com for more.
  20.                 if y <= max(p1y, p2y):
  21.                     if x <= max(p1x, p2x):. more info on 1point3acres.com
  22.                         if p1y != p2y:
  23.                             xints = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
  24.                         if p1x == p2x or x <= xints:. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
  25.                             inside = not inside-google 1point3acres
  26.             p1x, p1y = p2x, p2y

  27.         return inside

  28.     def test_when_poly_is_none(self):
  29.         """
  30.         When poly is None, any point should be
  31.         judged as not inside the polygon.
  32.         """. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
  33.         x = 0. 1point 3acres 璁哄潧
  34.         y = 0
    . 1point3acres.com/bbs
  35.         poly = None

  36.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))

  37.     def test_when_poly_is_a_point_and_different_from_the_input_point(self):
  38.         """
  39.         When poly is a point (not a real polygon),. from: 1point3acres.com/bbs
  40.         a different point should be judged as not inside the polygon.
  41.         """. visit 1point3acres.com for more.
  42.         x = 0-google 1point3acres
  43.         y = 0
  44.         poly = [(1, 1)]

  45.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))

  46.     def test_when_poly_is_a_point_and_as_same_as_the_input_point(self):
  47.         """. 鍥磋鎴戜滑@1point 3 acres
  48.         When poly is a point (not a real polygon),
  49.         the same point should be judged as not inside the polygon.
  50.         """
  51.         x = 1
  52.         y = 1
  53.         poly = [(1, 1)]
  54. . From 1point 3acres bbs
  55.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))

  56.     def test_when_poly_is_a_line_and_the_input_point_is_not_on_the_line(self):. more info on 1point3acres.com
  57.         """
  58.         When poly is a line (not a real polygon),
  59.         a point on the line should be judged as not inside the polygon.
  60.         """
  61.         x = 1
  62.         y = 2
  63.         poly = [(1, 1), (1, 3)]

  64.         self.assertEqual(False, self._is_point_in_poly(x, y, poly)). 1point 3acres 璁哄潧

  65.     def test_input_point_on_poly_vertex(self):. from: 1point3acres.com/bbs
  66.         """
  67.         When the input point is on the polygon's vertex,
  68.         the point should be judged as not inside the polygon..鐣欏璁哄潧-涓浜-涓夊垎鍦
  69.         """
  70.         x = 2
  71.         y = 4
  72.         poly = [(2, 4), (6, 4), (6, 2), (2, 2)]

  73.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))

  74.     def test_input_point_on_poly_edge(self):
  75.         """. 1point 3acres 璁哄潧
  76.         When the input point is on the polygon's edge,.鏈枃鍘熷垱鑷1point3acres璁哄潧
  77.         the point should be judged as not inside the polygon.. From 1point 3acres bbs
  78.         """. 1point 3acres 璁哄潧
  79.         x = 4
  80.         y = 4
  81.         poly = [(2, 4), (6, 4), (6, 2), (2, 2)]. 1point 3acres 璁哄潧

  82.         self.assertEqual(True, self._is_point_in_poly(x, y, poly)). 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷

  83.     def test_input_point_inside_poly(self):
  84.         """
  85.         When the input point is really inside the polygon,
  86.         the point should be judged as inside the polygon.
  87.         """
  88.         x = 3
  89.         y = 3
  90.         poly = [(2, 4), (6, 4), (6, 2), (2, 2)]. 1point 3acres 璁哄潧

  91.         self.assertEqual(True, self._is_point_in_poly(x, y, poly))

  92.     def test_input_point_outside_poly(self):. from: 1point3acres.com/bbs
  93.         """
  94.         When the input point is really outside the polygon,. from: 1point3acres.com/bbs
  95.         the point should be judged as outside the polygon.. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
  96.         """
  97.         x = 7
  98.         y = 7. 1point3acres.com/bbs
  99.         poly = [(2, 4), (6, 4), (6, 2), (2, 2)]

  100.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))

  101.     def test_input_point_outside_concave_polygon(self):
  102.         """
  103.         When the polygon is a concave polygon, and the input point
  104.         is outside the polygon, but inside the concave part.
  105.         the point should be judged as outside the polygon.
  106.         """. visit 1point3acres.com for more.
  107.         x = 4
  108.         y = 5
  109.         poly = [(2, 2), (2, 6), (3, 6), (3, 4), (5, 4), (5, 6), (6, 6), (6, 2)]
  110. . 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
  111.         self.assertEqual(False, self._is_point_in_poly(x, y, poly))
复制代码


仅供参考
回复 支持 反对

使用道具 举报

edyyy 发表于 2017-7-23 11:36:32 | 显示全部楼层

多谢楼主啊,好人好运
回复 支持 反对

使用道具 举报

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2017-11-23 15:39

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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