Given an interface, implement a solution to check whether a card was used more than X times in the last X hours.
Asked in the HackerRank assessment stage. Java question 1.
Implement is_overused(card_id, usage_times, x, current_time). card_id is a string, usage_times is a list of integer timestamps in hours, x is a positive integer, and current_time is the ending timestamp. Count usages in the inclusive interval [current_time - x, current_time]. Return True only when that count is greater than x; otherwise return False. Usage timestamps may be unsorted, and timestamps outside the interval must not be counted.
def is_overused(card_id, usage_times, x, current_time):