Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def equidistantTriples(coordinates)
- array_length = coordinates.length
- x = 0
- y = 1
- z = 2
- count = 0
- while (x < array_length)
- while (y < array_length)
- while (z < array_length)
- if coordinates[y] == (coordinates[x] + coordinates[z]) / 2.to_f then
- count = count + 1
- end
- z = z + 1
- end
- y = y + 1
- z = y + 1
- end
- x = x + 1
- y = x + 1
- z = y + 1
- end
- return count
- end
Advertisement
Add Comment
Please, Sign In to add comment