Google Interview Question
- 0of 2 votes
You are given two streams 's_a' and 's_b' of digits. Each stream represents an integer 'a' and 'b' from its less significant digit to the most significant digit. For example, integer 2048 is represented in the stream as 8, 4, 0, 2.- autoboli May 30, 2015 in United States
Write a function that subtract two integers 'a - b' and returns the result as a string. You are not allowed to buffer entire 'a' or 'b' into a single string, i.e. you may access only a single digit per stream at time (imagine that 'a' and 'b' are stored in huge files). You may assume that 'a>=b'.
s_a: 8 4 0 2
s_b: 4 2 0 1
| Report Duplicate | Flag | PURGE
Open Chat in New Window