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


一亩三分地论坛

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

Futurex firmware software 筛选题求助

[复制链接] |试试Instant~ |关注本帖
donghaox 发表于 2016-7-4 01:06:57 | 显示全部楼层 |阅读模式

2016(7-9月) 码农类 本科 全职@Futurex - 网上海投 - HR筛选 在线笔试 |Otherfresh grad应届毕业生

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

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

x
各路大神, 学霸,程序员们好不太确定应该发在求职一栏还是刷题一栏比较好,我最近投futurex 的 entry level firware SW,他们的HR回了我一封面试题,说实话,我对C++还不是太熟,所以也没油什么思路,所以想请地里的人看看~

#include <stdio.h>. From 1point 3acres bbs
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
. from: 1point3acres.com/bbs
typedef int int32;
typedef unsigned char int8;
. 1point 3acres 璁哄潧
static void integrate_arrays(int8  *output, int8  *input_1, const int8  *input_2, int32 length)
{
    int32 i = 0;

    for(i=0; i<length; i++)
    {
        output = (int8)(input_1 ^ input_2);
    }

    return;. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
}

static void itoa( int32 num, int8  *alpha, int32 radix ) 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
{. more info on 1point3acres.com
    if( radix == 10 )
    {
        sprintf(alpha, "%i", num);
    }
    else if( radix == 16 )
    {
        sprintf(alpha, "%X", num);
    }
}
.1point3acres缃
int8 *gen_modified_key(int8 modifier, const int8  *input_1, int32 length)
{
    int8  leading[3]; 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
    int32 i_leading;
    int8 * temp_string = NULL;
    int8 * ret;
    int32 i = 0;

    itoa(modifier/2, leading, 10);
    i_leading = atoi(leading);
    temp_string = (int8 *) malloc(8);
    ret = (int8 *) malloc(length);
    memset(temp_string, 0, 8);
    temp_string[0] = 0; . 鍥磋鎴戜滑@1point 3 acres

    if( (modifier+1)%2 == 0 ) {
        temp_string[0] = (int8)((i_leading<<4) + 8);
    }   
    else {. visit 1point3acres.com for more.
        temp_string[0] = (int8)(i_leading<<4);
    }   . 1point3acres.com/bbs

    for(i=0; i<(length>>3); i++)-google 1point3acres
    {. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
        integrate_arrays(ret+i*8, temp_string, input_1+i*8, 8);
    }   . visit 1point3acres.com for more.
    free(temp_string);
    return ret;
}   
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
// Do not change anything in main 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
// main only contains example input
// Change anything else. 鍥磋鎴戜滑@1point 3 acres
int main(int argc, char **argv) {

鏉ユ簮涓浜.涓夊垎鍦拌鍧.     // Example input data
    int8 data[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,
                     17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32};
    int8 *resp = gen_modified_key(0x10, data, sizeof(data));
    free(resp);
鏉ユ簮涓浜.涓夊垎鍦拌鍧.
    return 0;
}. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷

1.  What does the function gen_modified_key do?
2.  What problems or issues, if any, do you see with it?
3.  How could you improve the function, and what benefits would your improvements make?
4.  What other additional improvements could you make to the rest of the code?

In addition to answering the above questions in your response, we would also like you to re-write the code to incorporate your improvements. I would like to point out that the code is intentionally flawed and not indicative of our overall code quality. We would like you to improve it to make the function more efficient while ensuring the input parameters are the same, and the output matches what it would have been before your changes. We are looking for you to only make efficiency improvements, not changes related to security or functionality.

这个挺长的,可能不是太难,大家多多讨论,futurex他们公司在扩招,都是entry level SW 而且都是这道题, 希望地里的人都有希望进去

. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
. from: 1point3acres.com/bbs
 楼主| donghaox 发表于 2016-7-5 05:11:42 | 显示全部楼层
真的没有人看一眼吗。。。。
回复 支持 反对

使用道具 举报

Druss 发表于 2016-7-30 02:27:29 | 显示全部楼层
我昨天拿到了和你一样的题,请问你解决了么
回复 支持 反对

使用道具 举报

 楼主| donghaox 发表于 2016-8-3 02:02:34 | 显示全部楼层
Druss 发表于 2016-7-30 02:27
我昨天拿到了和你一样的题,请问你解决了么
. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
没有呀, 我对C不是很熟, 所有就放弃了,不过这个好心没有时间限制
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

custom counter

GMT+8, 2017-9-20 06:51

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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