Pergunta de entrevista da empresa Meta

Design a system to store large numbers and a function to add them.

Respostas da entrevista

Sigiloso

18 de abr. de 2014

I chose linked lists, and he asked me why not pick arrays. At the time I thought that having the freedom to add and remove digits for addition and subtraction make the linked list more ideal so I mentioned the arrays would cause more overhead than the linked list and described a simple carry ahead adder for base 10. Each node of the linked list represented a digit. The head represented the least significant digit, and increased the importance as you moved through. You'd add each node of the linked list with a carry temp variable and figure out the value to output through modulus and regular division.

15

Sigiloso

16 de out. de 2017

In Java and C, Strings are also arrays. As the person mentioned above: I guess it depends on what you are really designing.

Sigiloso

14 de fev. de 2016

what about storing them in string format? Having a logic to add numbers in the string format?

1