All Questions
9 questions
6
votes
3
answers
252
views
Detect loop in rectilinear path
Given a rectilinear path, find if it has a loop. A rectilinear path is made up of made up of alternating horizontal and vertical segments.
Input => Ordered set of points representing a rectilinear ...
7
votes
3
answers
3k
views
Determine if a triangle is equilateral, isosceles, or scalene
I've been fiddling around with some easy code challenges and there's one about determining if a triangle is equilateral, isosceles, or scalene.
I've come up with a working solution, but I feel this ...
5
votes
2
answers
3k
views
Given a list of coordinates check if 4 points make a line
I was doing some preparation for coding interviews and I came across the following question:
Given a list of coordinates "x y" return True if there exists a line ...
12
votes
1
answer
7k
views
2D Bin Packing Algorithm Implementation
I wrote a 2D greedy bin packing algorithm using Python 3.6
Heres a quick summary:
The algorithm consists of two classes (which I will attach at the end of this file along with a link to my github repo)...
5
votes
1
answer
1k
views
Shortest path around a set of points
Problem
I'm trying to get into Python and get a bit familiar with it, so I found a problem online to train. The problem was to find the shortest path around some points, given a set of nodes which ...
7
votes
1
answer
2k
views
Calculate angle between planes
I have written working code calculating the angle between the adjacent planes.
I read subsequently from standart input:
n - amount of triangles,
m - amount of vertices
ind[] - indices of the vertices ...
2
votes
2
answers
514
views
Python Kohonen algorithm
I've tried to implement the Kohonen algorithm using Python and I've managed to do this, but my result is so slow. I want to know if anyone knows how I can improve it.
Objective:
I have to read a file ...
5
votes
2
answers
14k
views
Closest distance between points in a list
In a course I'm doing, I was given the task of finding the closest pair of points among the given points. The program that passed all test cases was the following:
...
11
votes
3
answers
7k
views
Python implementation of the Ramer-Douglas-Peucker Algorithm
I recently implemented the RDP polygon approximation algorithm in Python and I'm skeptical of whether or not I implemented it correctly of with the greatest efficiency. The algorithm runs in around 0....