Design data structure for Scenario : we have array of strings where each string consists of user,endpoint,response code , timestamp . Need to list all valid requests based on different filtering conditions.
Asked in the round 2 stage.
Implement filter_requests(logs, filters). Each log is a string in the format user endpoint response_code timestamp, separated by spaces. Return the original strings that are valid requests, meaning response codes from 200 through 299, and that satisfy all provided filters. Supported filters are user, endpoint, response_code, start_timestamp, and end_timestamp. Omitted filters impose no restriction. Preserve input order.
def filter_requests(logs, filters):