Problem I have this array of objects: const dataset = [ {name: ‘Paul’, age: 10}, {name: ‘Marcus’, age: 5}, {name: […]
Tag: mapreduce
Summarizing the score of a personality quiz
Problem This function takes a list of questions and list of answers provided by the user. The list of answers […]
Weighted Probability Problem in Swift
Problem I was asked a weighted probability question in a technical interview a few months ago that went something like […]
Efficiently aggregating nested data
Problem Problem Given the following data: [ { “users”: [ { “id”: “07bde76f-aff0-407d-9241-a12b323d4af8”, “transactions”: [ { “category”: “purchase” }, { […]
Javascript + Filter object of values
Problem I have the object with values. I trying to filter based on values. var data = { “map”: { […]
Building objects in javascript, without “if(!a[k]) a[k] = []”
Problem When building objects using reduce, I often have crappy code like this: function mapArticlesByTagAndId(articles) { return articles.reduce((collector = {}, […]
Javascript + Filter object of values
Problem I have the object with values. I trying to filter based on values. var data = { “map”: { […]