Your question is Document Versioning Class. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Write a class that, given a list of documents, can return the latest version of all document types for a given state, starting with a basic implementation and iteratively improving performance.