10月28,K神开课讲数据科学,你来吗?


一亩三分地论坛

 找回密码
 获取更多干活,快来注册
Babeltime游戏工作室招工程师、美术和策划
Tubi TV招安卓、前端和机器学习工程师
把贵司招聘信息放这里
查看: 2416|回复: 2
收起左侧

Cryptic Studios 新鲜的面经

[复制链接] |试试Instant~ |关注本帖
九号大头菜 发表于 2015-8-11 02:39:23 | 显示全部楼层 |阅读模式

2015(7-9月) 码农类 硕士 全职@Cryptic Studios - 网上海投 - 在线笔试 |Otherfresh grad应届毕业生

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

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

x
Cryptic Studios 新鲜的面经.鐣欏璁哄潧-涓浜-涓夊垎鍦
网上海投[size=12.8000001907349px]Cryptic Studios[size=12.8000001907349px] 他们家的software engineer的职位,hr联系我说会有一个6~8小时的c test interview(OA), hr说最好能在5小时内完成,老师说被吓到了。昨天打开了链接, 题目确实是6~8小时的量,甚至是8+!做出了一道题,剩下一道木有时间了,于是草草交了。把题目发上来供大家参考,如果有面试它们家的小伙伴,可以提前看看题准备一两天,写出来了再面,个人觉得6~8小时搞定这两道题对于非大神级别的人来说还是很不科学的。. Waral 鍗氬鏈夋洿澶氭枃绔,
[size=12.8000001907349px]Speed is a factor, so the sooner you get it back to us, the better, but please do not send it back until it is complete. . 1point 3acres 璁哄潧
[size=12.8000001907349px]

[size=12.8000001907349px]Standard C or C++ are the preferred languages for this test, but this is not an absolute requirement. Please use a compiler to test your code. Don't worry about dealing with illegal inputs or giant data sets. You should *not* use reference materials (other than language references) for this test.
[size=12.8000001907349px]

[size=12.8000001907349px]Additionally, please specify how your test was compiled and run. If we cannot compile and run your test with a minimum of modification, it will receive a failing grade.
[size=12.8000001907349px].鏈枃鍘熷垱鑷1point3acres璁哄潧

[size=12.8000001907349px]
. Waral 鍗氬鏈夋洿澶氭枃绔,
[size=12.8000001907349px]1. Write a function that accepts a string of digits and a target value as input parameters. This function should output the two input values followed by a string with +'s and *'s between the digits so the result of evaluating the mathematical expression is the target value. Pay attention to operator precedence. Note there may be more than one answer, it doesn't matter which one you print. .鏈枃鍘熷垱鑷1point3acres璁哄潧
[size=12.8000001907349px].1point3acres缃
.鐣欏璁哄潧-涓浜-涓夊垎鍦
[size=12.8000001907349px]Examples:
[size=12.8000001907349px]"1231231234",11353 -> "12*3+1+23*123*4"
[size=12.8000001907349px]"3456237490",1185 -> "3*4*56+2+3*7+490"
[size=12.8000001907349px]"3456237490",9191 -> "no solution"
[size=12.8000001907349px].鐣欏璁哄潧-涓浜-涓夊垎鍦

[size=12.8000001907349px]

[size=12.8000001907349px]2. Write a function "void link(char **tiles)" that accepts a list of 'tiles' in the provided format below. It should link the tiles together sequentially in the order they are given, and print out the current count and arrangement of tiles at each step exactly as shown in the example output below, including the note about how far the tile had to be rotated.
[size=12.8000001907349px]

[size=12.8000001907349px]A tile is a 2-by-2 square split into quadrants, where each quadrant has a number from 0 to 9. After the first tile, a tile can be legally placed if at least two of its quadrants match quadrants on adjacent tiles horizontally or vertically. A tile cannot be legally placed in a location if it would have fewer than two matching quadrants or has any quadrants that do not match horizontally or vertically. Tiles can be rotated, and tiles can be placed in offset positions as demonstrated with tile 9 in the third example. The inputs are always designed so there is only one place a tile will fit.
[size=12.8000001907349px]
.1point3acres缃
[size=12.8000001907349px]Examples:
. from: 1point3acres.com/bbs [size=12.8000001907349px]char *tiles1[] = {
[size=12.8000001907349px]        "11",     // 1
[size=12.8000001907349px]        "23",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "44",     // 2
[size=12.8000001907349px]        "11",
[size=12.8000001907349px]        "",-google 1point3acres
[size=12.8000001907349px]        "16",     // 3. visit 1point3acres.com for more.
[size=12.8000001907349px]        "36",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "51",     // 4 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
[size=12.8000001907349px]        "71",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "46",     // 5
[size=12.8000001907349px]        "26",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "14",     // 6
[size=12.8000001907349px]        "68",
[size=12.8000001907349px]        0};. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
[size=12.8000001907349px].鐣欏璁哄潧-涓浜-涓夊垎鍦

[size=12.8000001907349px]

[size=12.8000001907349px]link(tiles1) prints:
[size=12.8000001907349px]
. from: 1point3acres.com/bbs

[size=12.8000001907349px]6 tiles
[size=12.8000001907349px]link 1
[size=12.8000001907349px]11
[size=12.8000001907349px]23. more info on 1point3acres.com
[size=12.8000001907349px]
[size=12.8000001907349px]link 2
[size=12.8000001907349px]44
.鏈枃鍘熷垱鑷1point3acres璁哄潧[size=12.8000001907349px]11
[size=12.8000001907349px]11
[size=12.8000001907349px]23
[size=12.8000001907349px] . from: 1point3acres.com/bbs
[size=12.8000001907349px]link 3
[size=12.8000001907349px]44
[size=12.8000001907349px]11
[size=12.8000001907349px]1116
[size=12.8000001907349px]2336
[size=12.8000001907349px]
[size=12.8000001907349px]link 4. From 1point 3acres bbs
[size=12.8000001907349px]  44. visit 1point3acres.com for more.
[size=12.8000001907349px]5111
[size=12.8000001907349px]711116
[size=12.8000001907349px]  2336
[size=12.8000001907349px]
[size=12.8000001907349px]link 5 // note this tile had to be rotated 180 degrees clockwise. From 1point 3acres bbs
[size=12.8000001907349px]  44
[size=12.8000001907349px]5111
[size=12.8000001907349px]71111662
[size=12.8000001907349px]  233664
[size=12.8000001907349px]
[size=12.8000001907349px]link 6 // note this tile had to be rotated 270 degrees clockwise
[size=12.8000001907349px]  4448
[size=12.8000001907349px]511116
[size=12.8000001907349px]71111662
[size=12.8000001907349px]  233664. Waral 鍗氬鏈夋洿澶氭枃绔,
[size=12.8000001907349px] .鏈枃鍘熷垱鑷1point3acres璁哄潧
[size=12.8000001907349px]
[size=12.8000001907349px]

[size=12.8000001907349px]. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
. 1point 3acres 璁哄潧
[size=12.8000001907349px]char *tiles2[] = {
[size=12.8000001907349px]        "12",        // 1
[size=12.8000001907349px]        "34",. From 1point 3acres bbs
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "36",        // 2
[size=12.8000001907349px]        "15",
[size=12.8000001907349px]        "",. 鍥磋鎴戜滑@1point 3 acres
[size=12.8000001907349px]        "56",        // 3.鐣欏璁哄潧-涓浜-涓夊垎鍦
[size=12.8000001907349px]        "78",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "78",        // 4
[size=12.8000001907349px]        "90",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "46",        // 5
[size=12.8000001907349px]        "26",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "88",        // 6
[size=12.8000001907349px]        "01",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "93",        // 7. visit 1point3acres.com for more.
[size=12.8000001907349px]        "54",. 1point 3acres 璁哄潧
[size=12.8000001907349px]        0};
[size=12.8000001907349px]

[size=12.8000001907349px]

[size=12.8000001907349px]link(tiles2) prints:
[size=12.8000001907349px]

[size=12.8000001907349px]7 tiles
[size=12.8000001907349px]link 1
[size=12.8000001907349px]12
[size=12.8000001907349px]34
[size=12.8000001907349px]

[size=12.8000001907349px]link 2 // note this tile had to be rotated 180 degrees clockwise
[size=12.8000001907349px]5112
[size=12.8000001907349px]6334
[size=12.8000001907349px]
. Waral 鍗氬鏈夋洿澶氭枃绔,
[size=12.8000001907349px]link 3 // note this tile had to be rotated 90 degrees clockwise-google 1point3acres
[size=12.8000001907349px]755112
[size=12.8000001907349px]866334-google 1point3acres
[size=12.8000001907349px]

[size=12.8000001907349px]link 4 // note this tile had to be rotated 90 degrees clockwise
[size=12.8000001907349px]97755112
[size=12.8000001907349px]08866334
[size=12.8000001907349px]-google 1point3acres

[size=12.8000001907349px]link 5 // note this tile had to be rotated 270 degrees clockwise
. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴[size=12.8000001907349px]97755112-google 1point3acres
[size=12.8000001907349px]08866334
[size=12.8000001907349px]   66. From 1point 3acres bbs
[size=12.8000001907349px]   42 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
[size=12.8000001907349px]

[size=12.8000001907349px]link 6 // note this tile had to be rotated 90 degrees clockwise
[size=12.8000001907349px]97755112
[size=12.8000001907349px]08866334
[size=12.8000001907349px]08 66
[size=12.8000001907349px]18 42
[size=12.8000001907349px]

[size=12.8000001907349px]link 7 // note this tile had to be rotated 270 degrees clockwise
[size=12.8000001907349px]97755112
[size=12.8000001907349px]08866334.鏈枃鍘熷垱鑷1point3acres璁哄潧
[size=12.8000001907349px]08 66 34-google 1point3acres
[size=12.8000001907349px]18 42 95-google 1point3acres
[size=12.8000001907349px]

[size=12.8000001907349px]

[size=12.8000001907349px]

[size=12.8000001907349px]

[size=12.8000001907349px]char *tiles3[] = {
[size=12.8000001907349px]        "11",     // 1
[size=12.8000001907349px]        "12",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "12",     // 2. 1point 3acres 璁哄潧
[size=12.8000001907349px]        "93",. visit 1point3acres.com for more.
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "93",     // 3.鐣欏璁哄潧-涓浜-涓夊垎鍦
[size=12.8000001907349px]        "99",
[size=12.8000001907349px]        "",. visit 1point3acres.com for more.
[size=12.8000001907349px]        "39",     // 4
[size=12.8000001907349px]        "98", 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "95",     // 5
[size=12.8000001907349px]        "86",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "57",     // 6. from: 1point3acres.com/bbs
[size=12.8000001907349px]        "66",
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "77",     // 7
[size=12.8000001907349px]        "57",
[size=12.8000001907349px]        "",.1point3acres缃
[size=12.8000001907349px]        "13",     // 8
[size=12.8000001907349px]        "24",
[size=12.8000001907349px]        "",. more info on 1point3acres.com
[size=12.8000001907349px]        "45",     // 9
[size=12.8000001907349px]        "47",.1point3acres缃
[size=12.8000001907349px]        "",
[size=12.8000001907349px]        "24",     // 10
[size=12.8000001907349px]        "39",
[size=12.8000001907349px]        0};. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
[size=12.8000001907349px]. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
.鐣欏璁哄潧-涓浜-涓夊垎鍦
[size=12.8000001907349px]link(tiles3) prints:
[size=12.8000001907349px]. 1point3acres.com/bbs

[size=12.8000001907349px]10 tiles.1point3acres缃
[size=12.8000001907349px]link 1
[size=12.8000001907349px]11
[size=12.8000001907349px]12.鏈枃鍘熷垱鑷1point3acres璁哄潧
[size=12.8000001907349px]
[size=12.8000001907349px]link 2
[size=12.8000001907349px]11
[size=12.8000001907349px]12
. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷[size=12.8000001907349px]12.1point3acres缃
[size=12.8000001907349px]93
[size=12.8000001907349px]
[size=12.8000001907349px]link 3
[size=12.8000001907349px]11. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
[size=12.8000001907349px]12
[size=12.8000001907349px]12
[size=12.8000001907349px]93. From 1point 3acres bbs
[size=12.8000001907349px]93.鏈枃鍘熷垱鑷1point3acres璁哄潧
[size=12.8000001907349px]99
[size=12.8000001907349px]
[size=12.8000001907349px]link 4
[size=12.8000001907349px]11. 1point3acres.com/bbs
[size=12.8000001907349px]12
[size=12.8000001907349px]12
[size=12.8000001907349px]93
[size=12.8000001907349px]9339
[size=12.8000001907349px]9998.1point3acres缃
[size=12.8000001907349px]
[size=12.8000001907349px]link 5
[size=12.8000001907349px]11
[size=12.8000001907349px]12
[size=12.8000001907349px]12
[size=12.8000001907349px]93
[size=12.8000001907349px]933995
[size=12.8000001907349px]999886
[size=12.8000001907349px]
[size=12.8000001907349px]link 6. 鍥磋鎴戜滑@1point 3 acres
[size=12.8000001907349px]11
[size=12.8000001907349px]12
[size=12.8000001907349px]12
[size=12.8000001907349px]93
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px]
[size=12.8000001907349px]link 7
[size=12.8000001907349px]11
[size=12.8000001907349px]12. From 1point 3acres bbs
[size=12.8000001907349px]12    77
[size=12.8000001907349px]93    57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px] -google 1point3acres
[size=12.8000001907349px]link 8
[size=12.8000001907349px]1113
[size=12.8000001907349px]1224
[size=12.8000001907349px]12    77
[size=12.8000001907349px]93    57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666. from: 1point3acres.com/bbs
[size=12.8000001907349px]
[size=12.8000001907349px]link 9
[size=12.8000001907349px]1113
[size=12.8000001907349px]122445
[size=12.8000001907349px]12  4777. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
[size=12.8000001907349px]93    57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px] . from: 1point3acres.com/bbs
[size=12.8000001907349px]link 10
[size=12.8000001907349px]1113
[size=12.8000001907349px]122445
[size=12.8000001907349px]12244777-google 1point3acres
[size=12.8000001907349px]9339  57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px]祝各位好运~🍀


swing 发表于 2015-8-11 03:51:57 | 显示全部楼层
谢谢分享,虽然我不会C的面试~
回复 支持 反对

使用道具 举报

huangsilion 发表于 2015-8-12 03:44:52 | 显示全部楼层
public static String calculation(String str, int target) {                 String n = "no solution";                 if (str == null || str.length() == 0)                         return n;                 int len = str.length();                 int sum = 0;                 String result = "";                 List<String> list = new ArrayList<String>();                 rec(0, len, result, str, target, list);                 if (list.size() > 0)                         return list.get(0);                 else                         return n;          }          public static void rec(int s, int len, String result, String str,                         int target, List<String> list) {                 if (s == len && calculate(result) == target)                         list.add(new String(result));                 for (int i = s; i < len; i++) {                         String temp = str.substring(s, i + 1);                         if (i + 1 != len) {                                 rec(i + 1, len, result + temp + "+", str, target, list);                                 rec(i + 1, len, result + temp + "*", str, target, list);                         } else                                 rec(i + 1, len, result + temp, str, target, list);                  }          }          public static int calculate(String s) {                 if (s == null)                         return 0;                 s = s.trim().replaceAll(" +", "");                 int length = s.length();                  int res = 0;                 long preVal = 0; // initial preVal is 0                 char sign = '+'; // initial sign is +                 int i = 0;                 while (i < length) {                         long curVal = 0;                         while (i < length && (int) s.charAt(i) <= 57                                         && (int) s.charAt(i) >= 48) { // int                                 curVal = curVal * 10 + (s.charAt(i) - '0');                                 i++;                         }                         if (sign == '+') {                                 res += preVal; // update res                                 preVal = curVal;                         } else if (sign == '*') {                                 preVal = preVal * curVal; // not update res, combine preVal &                                                                                         // curVal and keep loop                         }                         if (i < length) { // getting new sign                                 sign = s.charAt(i);                                 i++;                         }                 }                 res += preVal;                 return res;         }
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

custom counter

GMT+8, 2017-9-21 07:53

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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