Skip to content
Advertisement

Function to get user_id’s that had their opt-in status changed after processing of the change log

Given a list of users with their opt-in statuses and sequential change log of opt-in status updates that is applied to user list, I am trying to write a function to get a list of all user_ids (sorted by id) that had their opt-in status changed after processing of the change log

Sample Input:

JavaScript

Sample Output

JavaScript

My function takes two parameters, but I am not entirely sure how to extract user_id who had their opt-in changed

JavaScript

EDIT: users not stored in user list are considered opted_out

Advertisement

Answer

I would do it this way

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement