11956 - Brainfuck


Difficulty : easy

Solution Description :

Ad hoc problem

when you use unsigned char mem[100] then this problem is very easy

Initially set all value of mem[] array by 0 and p=0

if command = '>'  then increment p
if command = '<'  then decrements p
if command = '+'  then increment mem[p]
if command = '-'   then decrements mem[p]

remember p must be between 0 and 99 because LED display has an array of 100 bytes of circular memory

When all command are execute then print the all value of mem[] array into hexadecimal format.
i.e. printf("%02X",mem[i])