All Questions
7 questions
5
votes
2
answers
329
views
Porting PHP's array_push to Python
I am new to Python but not new to PHP. I've started porting PHP APIs to Python hoping to learn the Python language along the way, currently trying to grasp List, Dict, Set, Tuple. I tried writing PHP'...
7
votes
2
answers
827
views
Number of occurrences of strings in array
This is a Hackerrank problem (https://www.hackerrank.com/challenges/sparse-arrays/problem).
We're given an array of strings and an array of queries, and have to return an array of the number of ...
9
votes
3
answers
1k
views
Creating an affinity-matrix between protein and RNA sequences
I wrote an algorithm that analyzes protein-RNA interactions and I found that the following function is the bottleneck that causes performance issues:
...
5
votes
3
answers
2k
views
Associating a name with each bit in a bitmask
I have the following code:
...
3
votes
3
answers
9k
views
Intersection of subset between two lists of dicts
I want to find the intersection of two lists of dicts.
Note that equality—i.e.: what is to appear in the intersection—is given by which keys they must have equal. See the ...
10
votes
3
answers
86k
views
Convert dict entries to sets and lists
Can you please tell me if there is a better way to do this?
...
6
votes
3
answers
949
views
Parsing a complicated CSV generated on election nights
I have a Python script which parses a complicated CSV generated on election nights. Each row of the CSV represents a race. As I loop through the races, I store the candidates for each race into a list ...