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

Akuna Capital OA

全局:

2016(7-9月) 码农类General 硕士 全职@akunacapital - 网上海投 -   | | | 应届毕业生
第一次发面筋,90分钟OA,共5题,
1 删除字符串中的某个字符
2 忘记了,easy
3 在一个数组中找2个值与给定值最接近的数
4
5 求一个长字符串用空格分开单词,找寻 单词 a 和单词 b 最大间隔 n 的次数,这个题目我觉得超坑爹,有4个输入,input, a, b,
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
11)-> 0(00)

补充内容 (2016-8-27 04:24):
无悬念,挂了,建议做这家oa前一定要熟悉c++ 或者python

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x

评分

参与人数 4大米 +86 收起 理由
fantasiasango + 3 感谢分享!
whdawn + 40
lookbackinanger + 3 感谢分享!
夏虫不知雪花 + 40

查看全部评分


上一篇:Palantir Forward Deployed Engineer 电面
下一篇:AppFolio电面一面面经
推荐
 楼主| fish444555 2016-9-18 11:58:21 | 只看该作者
全局:
shaoli12800 发表于 2016-9-18 11:12
多谢楼主的分享!学习到好多, 关于第二题·bit invert, 如果直接用 ~, 肯定是不行, 楼主有什么好办法吗 ...
  1. public int tt(int num) {
  2.                 int res = 0;
  3.                 int idx = 0;
  4.         while (num > 0) {               
  5.                 res |= (((num & 0x1) ^ 0x1) << idx++);
  6.                 num >>= 1;
  7.         }
  8.         return res;
  9.     }
复制代码

评分

参与人数 2大米 +2 收起 理由
jpeng7 + 1 回答的很好!
shaoli12800 + 1 受教

查看全部评分

回复

使用道具 举报

推荐
 楼主| fish444555 2016-8-23 06:36:27 | 只看该作者
全局:
huai10 发表于 2016-8-22 23:46
楼主第四题有啥想法么
  1. class tt {

  2.         /**
  3.          * @param args
  4.          */
  5.         public static void main(String[] args) {
  6.                 // TODO Auto-generated method stub
  7.                 int[] nums1 = { 8, 9, 10, 1, 2, 3, 4};
  8.                 int[] nums2 = { 8, 9, 10, 1, 2, 3};
  9.                 int[] nums3 = { 10, 9, 2, 5, 3, 7};
  10.                 Solution tt = new Solution();
  11.                 List<Integer> res = tt.LongestSortedSubrange(nums1, 3);
  12.                 for (int j = 0; j < res.size(); j++) {
  13.                         System.out.print(res.get(j) + "\t");
  14.                 }
  15.                 System.out.println();
  16.                 res = tt.LongestSortedSubrange(nums2, 3);
  17.                 for (int j = 0; j < res.size(); j++) {
  18.                         System.out.print(res.get(j) + "\t");
  19.                 }
  20.                 System.out.println();
  21.                 res = tt.LongestSortedSubrange(nums3, 3);
  22.                 for (int j = 0; j < res.size(); j++) {
  23.                         System.out.print(res.get(j) + "\t");
  24.                 }
  25.         }
  26. }



  27. class Solution {
  28.     public List<Integer> LongestSortedSubrange(int[] nums, int m) {
  29.         List<Integer> res = new ArrayList<Integer>();
  30.         if (nums == null || nums.length == 0) {
  31.             return res;
  32.         }
  33.         //record every element idx
  34.         Map<Integer, Integer> map = new HashMap<>();
  35.                 for (int i = 0; i < nums.length; i++) {
  36.             map.put(nums[i], i);
  37.         }
  38.         Arrays.sort(nums);
  39.         dfs(nums, m, res, new ArrayList<Integer>(), nums.length - 1, map);
  40.         return res;
  41.     }

  42.     private void dfs(int[] nums, int m, List<Integer> res, List<Integer> cur, int pos, Map<Integer, Integer> map) {
  43.             // get the longest one
  44.         if (pos < 0 && m >= nums.length - cur.size() && cur.size() > res.size()) {
  45.                 res.clear();
  46.                 res.addAll(cur);
  47.             return;
  48.         }
  49.         // get the biggest summation
  50.         if (pos < 0 && m >= nums.length - cur.size() && cur.size() == res.size()) {
  51.             int resSum = 0, curSum = 0;
  52.             for (int i = 0; i < cur.size(); i++) {
  53.                 resSum += res.get(i);
  54.                 curSum += cur.get(i);
  55.             }
  56.             if (curSum > resSum) {
  57.                     res.clear();
  58.                     res.addAll(cur);
  59.             }
  60.             return;
  61.         }
  62.         for (int i = pos; i >= 0; i--) {     
  63.                 //begin from last one, find the longest sub-sequence
  64.                 if (cur.isEmpty()) {
  65.                         cur.add(nums[i]);
  66.                         dfs(nums, m, res, cur, i - 1, map);
  67.                         cur.remove(0);
  68.                 }
  69.                 //the idx of i_th element greater than the idx of 0 element of cur
  70.                 //cannot contruct a increasing sub-sequence
  71.                 else if (map.get(nums[i]) > map.get(cur.get(0))) {
  72.                         if (i == 0) {
  73.                                 dfs(nums, m, res, cur, i - 1, map);
  74.                 }
  75.             }
  76.             else {
  77.                 cur.add(0, nums[i]);
  78.                 dfs(nums, m, res, cur, i - 1, map);
  79.                 cur.remove(0);
  80.             }
  81.         }
  82.     }
  83. }
复制代码
不确定是否正确,只测试了简单的例子

int[] nums1 = { 8, 9, 10, 1, 2, 3, 4};

tt.LongestSortedSubrange(nums1, 3);
1        2        3        4       

int[] nums2 = { 8, 9, 10, 1, 2, 3};
res = tt.LongestSortedSubrange(nums2, 3);
8        9        10       

int[] nums3 = { 10, 9, 2, 5, 3, 7};
res = tt.LongestSortedSubrange(nums3, 3);
2        5        7

有什么想法大家讨论一下
回复

使用道具 举报

推荐
 楼主| fish444555 2016-8-23 08:24:05 | 只看该作者
全局:
fish444555 发表于 2016-8-23 06:36
不确定是否正确,只测试了简单的例子

int[] nums1 = { 8, 9, 10, 1, 2, 3, 4};

之前想复杂了,而且排序,应该不需要, 测试例子和输出一样
  1. class tt {

  2.         /**
  3.          * @param args
  4.          */
  5.         public static void main(String[] args) {
  6.                 // TODO Auto-generated method stub
  7.                 int[] nums1 = { 8, 9, 10, 1, 2, 3, 4};
  8.                 int[] nums2 = { 8, 9, 10, 1, 2, 3};
  9.                 int[] nums3 = { 10, 9, 2, 5, 3, 7};
  10.                 Solution tt = new Solution();
  11.                 List<Integer> res = tt.LongestSortedSubrange(nums1, 3);
  12.                 for (int j = 0; j < res.size(); j++) {
  13.                         System.out.print(res.get(j) + "\t");
  14.                 }
  15.                 System.out.println();
  16.                 res = tt.LongestSortedSubrange(nums2, 3);
  17.                 for (int j = 0; j < res.size(); j++) {
  18.                         System.out.print(res.get(j) + "\t");
  19.                 }
  20.                 System.out.println();
  21.                 res = tt.LongestSortedSubrange(nums3, 3);
  22.                 for (int j = 0; j < res.size(); j++) {
  23.                         System.out.print(res.get(j) + "\t");
  24.                 }
  25.         }
  26. }



  27. class Solution {
  28.     public List<Integer> LongestSortedSubrange(int[] nums, int m) {
  29.         List<Integer> res = new ArrayList<Integer>();
  30.         if (nums == null || nums.length == 0) {
  31.             return res;
  32.         }
  33.         dfs(nums, m, res, new ArrayList<Integer>(), 0);
  34.         return res;
  35.     }

  36.     private void dfs(int[] nums, int m, List<Integer> res, List<Integer> cur, int pos) {
  37.             // get the longest one
  38.         if (m >= nums.length - cur.size() && cur.size() > res.size()) {
  39.                 res.clear();
  40.                 res.addAll(cur);
  41.             return;
  42.         }
  43.         // get the biggest summation
  44.         if (m >= nums.length - cur.size() && cur.size() == res.size()) {
  45.             int resSum = 0, curSum = 0;
  46.             for (int i = 0; i < cur.size(); i++) {
  47.                 resSum += res.get(i);
  48.                 curSum += cur.get(i);
  49.             }
  50.             if (curSum > resSum) {
  51.                     res.clear();
  52.                     res.addAll(cur);
  53.             }
  54.             return;
  55.         }
  56.         for (int i = pos; i < nums.length; i++) {     
  57.                 if (cur.isEmpty()) {
  58.                         cur.add(nums[i]);
  59.                         dfs(nums, m, res, cur, i + 1);
  60.                         cur.remove(cur.size() - 1);
  61.                 }
  62.                 else if (nums[i] > cur.get(cur.size() - 1)) {
  63.                 cur.add(nums[i]);
  64.                 dfs(nums, m, res, cur, i + 1);
  65.                 cur.remove(cur.size() - 1);
  66.             }
  67.         }
  68.     }
  69. }
复制代码
回复

使用道具 举报

🔗
Tsien 2016-8-21 11:53:40 | 只看该作者
全局:
第5题遇到同样的问题,我是从input参数中把其他几个参数读出来的,花了很多时间在这上面,之前通不过还以为是算法问题。。。
这是不是应该向HR反映啊
回复

使用道具 举报

🔗
 楼主| fish444555 2016-8-21 21:28:51 | 只看该作者
全局:
Tsien 发表于 2016-8-21 11:53
第5题遇到同样的问题,我是从input参数中把其他几个参数读出来的,花了很多时间在这上面,之前通不过还以为 ...

我因为不熟c++,花了不少时间在语言的转换上,而且第5题因为它的输入问题,所以也花了不少时间,所以第4题没时间做。我不打算反映了,因为自己确实有问题
回复

使用道具 举报

🔗
simonw27 2016-8-21 22:36:09 | 只看该作者
全局:
这家怎么申啊,要内推嘛?
回复

使用道具 举报

🔗
 楼主| fish444555 2016-8-21 23:52:07 | 只看该作者
全局:
simonw27 发表于 2016-8-21 22:36
这家怎么申啊,要内推嘛?

海投直接oa
字数字数字数
回复

使用道具 举报

🔗
simonw27 2016-8-22 00:58:31 | 只看该作者
全局:
fish444555 发表于 2016-8-21 23:52
海投直接oa
字数字数字数

酱紫 thanks~
回复

使用道具 举报

🔗
liangyue268 2016-8-22 08:32:13 | 只看该作者
全局:
感谢楼主分享面经!我也拿到oa了,请问楼主投的是Junior Developer吗?还有做之前能看到用什么语言吗,还是要点进去以后才知道?
回复

使用道具 举报

🔗
 楼主| fish444555 2016-8-22 08:59:43 | 只看该作者
全局:
liangyue268 发表于 2016-8-22 08:32
感谢楼主分享面经!我也拿到oa了,请问楼主投的是Junior Developer吗?还有做之前能看到用什么语言吗,还是 ...

我应该是投这个,基本是点进去那题才能看到用什么语言,大部分题都是 c++ & python 3, 我看到有一道题还有 python 2
回复

使用道具 举报

🔗
liangyue268 2016-8-22 10:00:27 | 只看该作者
全局:
fish444555 发表于 2016-8-22 08:59
我应该是投这个,基本是点进去那题才能看到用什么语言,大部分题都是 c++ & python 3, 我看到有一道题还 ...

感谢,这5道题都是coding对吧?貌似没有选择题了?
回复

使用道具 举报

🔗
 楼主| fish444555 2016-8-22 10:54:37 | 只看该作者
全局:
liangyue268 发表于 2016-8-22 10:00
感谢,这5道题都是coding对吧?貌似没有选择题了?

5题都是coding, nothing else
回复

使用道具 举报

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

本版积分规则

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