← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a system to manage Reddit community moderators based on action logs.
Background: Reddit communities have moderators with a hierarchy. Senior moderators (added earlier) can remove junior ones. Moderators are ordered by when they were added.
Log Format:
Each line: mod_given_access, action, mod_taking_action, timestamp
action: "added" or "removed"Part 1 - Basic Implementation:
ModList(log_string) - Constructor that parses logcan_remove_mod(user1, user2) - Can user2 remove user1? (user2 must be more senior)get_mod_list() - Return list of all current moderators in orderPart 2 - Multiple Communities: Each community has its own mod list. Update methods to take community_id.
Part 3 - Demote Function:
demote(user) - Move user down one position in the hierarchy.
Example: [user_1, user_2, user_3] → demote(user_1) → [user_2, user_1, user_3]
Constraints: