FB Onsite
Anonymous User
903

You need to design hash generator service. consisting of 0-9,a-z,A-Z only.
HashService(int K)
getNextHash();
Constraints:

  1. generated hash should not have any character repeated continoulsy for K times.
  2. You cannot store previous generated hashes.
  3. Service will run for years..

I suggested an iterator based approach, where new key is generated based on last generated key.

Any better approach.

Comments (4)
No comments yet.