注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
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小时搞定这两道题对于非大神级别的人来说还是很不科学的。
[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.
[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]
[size=12.8000001907349px]
[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.
[size=12.8000001907349px]
[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]
[size=12.8000001907349px]Examples:
[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] "",
[size=12.8000001907349px] "16", // 3
[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]
[size=12.8000001907349px]6 tiles
[size=12.8000001907349px]link 1
[size=12.8000001907349px]11
[size=12.8000001907349px]23
[size=12.8000001907349px]
[size=12.8000001907349px]link 2
[size=12.8000001907349px]44
[size=12.80000]93
[size=12.8000001907349px]933995
[size=12.8000001907349px]999886
[size=12.8000001907349px]
[size=12.8000001907349px]link 6
[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
[size=12.8000001907349px]12 77
[size=12.8000001907349px]93 57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px]
[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
[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]
[size=12.8000001907349px]link 10
[size=12.8000001907349px]1113
[size=12.8000001907349px]122445
[size=12.8000001907349px]12244777
[size=12.8000001907349px]9339 57
[size=12.8000001907349px]93399557
[size=12.8000001907349px]99988666
[size=12.8000001907349px]祝各位好运~🍀
|