American Express

  www.americanexpress.com
Work in HR? Unlock Free Profile

American Express Lead Developer Interview Question

I interviewed in Saint Petersburg, FL and was asked:
"How would you implement a limited capacity cache that can be used as a temporary storage with expiry."
Tags: algorithm
Add Tags [?]
Answer

Part of a Lead Developer Interview Review - one of 502 American Express Interview Reviews

Answers & Comments

0
of 0
votes
Use a static list of objects and always add new items to the end of the list

Every time an item is accessed from the list, remove it from its current position and add to the end of the list.

Whenever you reach the maximum allowed items in the list please remove the item in the top of the list.

Make sure any operation that adds or removes items from the list places a write lock on the list.
- Interview Candidate on Oct 8, 2013

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.