Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on I'm a cargo cult programmer, help me. Parent comment
i) convert the array of arrays of chars into an array of arrays of integers (the letters ASCII values).
ii) create a new integer array containing the sum of the cubes of each ASCII value for each entry
iii) create an empty hash table and fill it with (key|value) pairs containing (integer|number of occurrences) by looping through the previous array
iv) sort the hash table by 'number of occurrences' and store the biggest (key|value) pair
v) look for the first match in the original array to find which chars it represents
Efficient/correct or not?
i) convert the array of arrays of chars into an array of arrays of integers (the letters ASCII values).
ii) create a new integer array containing the sum of the cubes of each ASCII value for each entry
iii) create an empty hash table and fill it with (key|value) pairs containing (integer|number of occurrences) by looping through the previous array
iv) sort the hash table by 'number of occurrences' and store the biggest (key|value) pair
v) look for the first match in the original array to find which chars it represents
Efficient/correct or not?