Google Interview Question
Software Engineer / Developerspublic static Byte[] hexToByteBuf(String hex){
Byte[] buf = new Byte[hex.length()%2 == 0 ? hex.length()/2:(hex.length()/2)+1];
for(int i = 0; i<hex.length(); i++){
buf[i/2] = (i%2 == 0) ? 0 : (byte) (buf[i/2]<<4);
char c = hex.charAt(i);
if(c<=57)
buf[i/2] = (byte) (buf[i/2] | c-48);// "0" : 48
else
buf[i/2] = (byte) (buf[i/2] | c-55);// "A" : 65
}
return buf;
}
# private byte[] String_To_Bytes(string strInput)
# {
# // i variable used to hold position in string
# int i = 0;
# // x variable used to hold byte array element position
# int x = 0;
# // allocate byte array based on half of string length
# byte[] bytes = new byte[(strInput.Length) / 2];
# // loop through the string - 2 bytes at a time converting
# // it to decimal equivalent and store in byte array
#
while (strInput.Length > i + 1)
# {
# long lngDecimal = Convert.ToInt32(strInput.Substring(i, 2), 16);
# bytes[x] = Convert.ToByte(lngDecimal);
# i = i + 2;
# ++x;
# }
# // return the finished byte array of decimal values
# return bytes;
# }
Dear mother fucker AM ....
please write the answers clearly...
If you dont know any thing, please leave it no need of ur comments,
plzz dont write..how u fucked ur mother.
may I ask if it is phone or onsite interview? What position? Were some of questions related to your own background?
Seems to be quite different than other google interviews: not focused on algorithm/coding problems.
social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/46272ef0-59e6-47f2-bcce-166947e2cdb5
- Anonymous July 14, 2010