Skip to content Skip to sidebar Skip to footer
Showing posts with the label Algorithm

Group Consecutive Integers Together

Have the following code: import sys ints = [1,2,3,4,5,6,8,9,10,11,14,34,14,35,16,18,39,10,29,30,1… Read more Group Consecutive Integers Together

How To Find Horizon Line Efficiently In A High-altitude Photo?

I am trying to detect the horizon in images taken from high altitude, so as to determine the orient… Read more How To Find Horizon Line Efficiently In A High-altitude Photo?

Size Of Subtree In Python

Almost every online tutorial I see on the subject when it comes to finding the size of a subtree in… Read more Size Of Subtree In Python

Cube Root Modulo P -- How Do I Do This?

I am trying to calculate the cube root of a many-hundred digit number modulo P in Python, and faili… Read more Cube Root Modulo P -- How Do I Do This?

How To Update Content Popularity Scoring Such As Hacker News Algorithm?

I'm using a customized version of Hacker News popularity algorithm for my social site (items wi… Read more How To Update Content Popularity Scoring Such As Hacker News Algorithm?

Python Check String Contains All Characters

I'm reading in a long list of words, and I made a node for every word in the list. Each node ha… Read more Python Check String Contains All Characters

Shortest Path From Goal To Root In Directed Graph With Cycles Python

I want to find the shortest path from goal to root working backwards My input for root is {'434… Read more Shortest Path From Goal To Root In Directed Graph With Cycles Python

Stacking Boxes Into Fewest Number Of Stacks Efficiently?

I got this question in an online coding challenge. Given a list of boxes with length and widths (l,… Read more Stacking Boxes Into Fewest Number Of Stacks Efficiently?

Easier Way To Find Nodes In A Dataframe

Given a parent, I would like to get its nodes, of level N (original dataframe is way larger) child|… Read more Easier Way To Find Nodes In A Dataframe

How Can I Order A List Of Connections

I currently have a list of connections stored in a list where each connection is a directed link th… Read more How Can I Order A List Of Connections

Python: Powerset Of A Given Set With Generators

I am trying to build a list of subsets of a given set in Python with generators. Say I have set([1… Read more Python: Powerset Of A Given Set With Generators

Binpacking -- Multiple Constraints: Weight+volume

I have a dataset with 50,000 orders. Each order has ~20 products. Product volume and weight are pre… Read more Binpacking -- Multiple Constraints: Weight+volume

Vectorize Numpy Mean Across The Slices Of An Array

Is there a way to vectorize a function so that the output would be an array of means where each mea… Read more Vectorize Numpy Mean Across The Slices Of An Array

Tuples Partial Match

I have a tuple of tuples and a tuple. I'm interested to know which elements of the first tuple … Read more Tuples Partial Match

Is There A More Efficient Way Generate An Array From Another Array With A Little Bit Complex Rule?

I am trying to compute a distance between an element and a starting point in an array. Here is an a… Read more Is There A More Efficient Way Generate An Array From Another Array With A Little Bit Complex Rule?

Tarjan's Strongly Connected Components Algorithm In Python Not Working

I implemented the Tarjan's strongly connected components algorithm, according to wikipedia, in … Read more Tarjan's Strongly Connected Components Algorithm In Python Not Working

Longest Substring With Non-repeating Character

I am trying to solve the problem of finding the longest substring without a repeating character fro… Read more Longest Substring With Non-repeating Character

Pixel Coordinates From Point A To B

I have a gray scale 50 x 50 pixels picture as a numpy 2D array. Each pixel is a coordinate startin… Read more Pixel Coordinates From Point A To B

Finding Natural Numbers Having N Trailing Zeroes In Factorial

I need help with the following problem. Given an integer m, I need to find the number of positive… Read more Finding Natural Numbers Having N Trailing Zeroes In Factorial

Finding Unique Loops In The Closed Graph

I finally managed to write a code to identify all the loops possible with the current configuration… Read more Finding Unique Loops In The Closed Graph