본문 바로가기
CodeSignal/Arcade

CodeSignal [58/60] messageFromBinaryCode

by 벤진[Benzene] 2020. 5. 28.

Problem:

You are taking part in an Escape Room challenge designed specifically for programmers. In your efforts to find a clue, you've found a binary code written on the wall behind a vase, and realized that it must be an encrypted message. After some thought, your first guess is that each consecutive 8 bits of the code stand for the character with the corresponding extended ASCII code.

Assuming that your hunch is correct, decode the message.

 

Example

For code = "010010000110010101101100011011000110111100100001", the output should be
messageFromBinaryCode(code) = "Hello!".

The first 8 characters of the code are 01001000, which is 72 in the binary numeral system. 72 stands for H in the ASCII-table, so the first letter is H.
Other letters can be obtained in the same manner.

 

-Summary-

1. For every 8 bits of code, change the bit to string by using int(number, base=2)

2. Once the number converted, change the number to the Ascii value

 

모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]

https://codesignal.com/

'CodeSignal > Arcade' 카테고리의 다른 글

CodeSignal [60/60] sudoku  (0) 2020.05.28
CodeSignal [59/60] spiralNumbers  (0) 2020.05.28
CodeSignal [57/60] fileNaming  (0) 2020.05.28
CodeSignal [56/60] digitsProduct  (0) 2020.05.28
CodeSignal [55/60] differentSquares  (0) 2020.05.28

댓글