注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
做了scientech的quant developer的笔试题 感觉还比较简单 看地里都没有相关的面经,于是自爆下。问题大致如下:
Variable-length encoding is a way to encode integers space-efficiently. An integer to be encoded is split into 7-bit chunks, each of which is encoded as the 7 least significant bits of an output byte, while the most significant bit (MSB) signifies whether there are more bytes following this one. The last byte of an encoded integer always has 0 as its MSB. Here is an example of encoding decimal number 558 using variable-length encoding algorithm.
1. Represent the value in binary notation: 558 is 00001000101110.
2. Split into 7-bit chunks starting from the least significanitive and negative integers? Please explain how you can modify the current binary representation to allow both positive and negative number. Then put your ideas into code.
Feel free to share code between two questions, but please comment clearly as how we can use it as the basic positive integer library and how we can use it for signed integers.
还是比较友善的,请加米!!! |