Stewardesses, sweaterdresses and aftercataract

Searching for the longest word that can be written with left hand touch typing I used the following code, that uses the English words list found in https://github.com/dwyl/english-words. That gave the word ‘aftercataract’ as a result. Aftercataract does not come up as a result to this question though it’s in both Merriem-Webster and wictionary. Another… Continue reading Stewardesses, sweaterdresses and aftercataract

Space-time tradeoff

Yesterday Cassidy Williams (@cassidoo) sent the following problem through her newsletter (do subscribe): Assume you are given an unsorted list of numbers where everything is duplicated twice except for one number. Find and return that one number! How many solutions can you think of? Example input: [1,2,3,6,4,9,9,2,1,4,6] Example output: 3 My first solution was the… Continue reading Space-time tradeoff

Importing groupie

The following code transforms a string of zeros and ones in a form of consecutive zeros and ones. E.g., “00001110000111” will be 4,3,4,3. Without importing I had written the following code for the same task: For a minute I thought that the original code was more readable than the groupby one but I was wrong.