anca.grigoras88
BAN USER- 1of 1 vote
AnswersAmazon wants to implement a new backup system, in which files are stored into data tapes. This new system must follow the following 2 rules:
- anca.grigoras88 in United States
1. Never place more than two files on the same tape.
2. Files cannot be split across multiple tapes.
It's guaranteed that all tapes have the same size and that they will always be able to store the largest file.
Every time this process is executed, we already know the size of each file, and the capacity of the tapes. Having that in mind, we want to design a system that is able to count how many tapes will be required to store the backup in the most efficient way.
The parameter of your function will be a structure that will contain the file sizes and the capacity of the tapes. You must return the minimum amount of tapes required to store the files.
Example:
Input: Tape Size = 100; Files: 70, 10, 20
Output: 2| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind the first word in a stream in which it is not repeated in the rest of the stream. Please note that you are being provided a stream as a source for the characters. The stream is guaranteed to eventually terminate (i.e. return false from a call to the hasNext() method), though it could be very long. You will access this stream through the provided interface methods. A call to hasNext() will return whether the stream contains any more characters to process. A call to getNext() will return the next character to be processed in the stream. It is not possible to restart the stream.
- anca.grigoras88 in United States
Example:
Input: The angry dog was red. And the cat was also angry.
Output: dog
In this example, the word ‘dog’ is the first word in the stream in which it is not repeated in the stream.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm