Skip to content

Latest commit

 

History

History

hw08

HW08 - Collinearity of Galaxies

Description

In astronomical observations, astronomers are studying whether the arrangement of multiple galaxies follows a certain pattern. They need to determine if the observed galaxies lie on a straight line, which is crucial for their research on the motion and distribution of galaxies. Given a set of galaxy coordinates, each point represented by (x, y), design an algorithm to determine if these galaxies are collinear. If all the galaxies are collinear, return True; otherwise, return False.

Examples

Example 1:

Input: array = [[1, 2],[1, 3],[1, 4]]
Output: True

Example 1:

Input: array = [[0, 0],[1, 0],[1, 1],[0, 1]]
Output: False

File Structure

./
├─ HW8_test_data                    # Test Cases
├─ LLK.java                         # Abstract Class
├─ HW08.java                        # Runner
├─ HW08_4111056036_1.java           # Version 1
├─ HW08_4111056036_2.java           # Version 2
├─ HW08_4111056036_3.java           # Version 3
├─ HW08_4111056036_4.java           # Version 4
├─ HW08_4111056036_5.java           # Version 5
├─ StopWatch.java                   # Class for Calculate Runtime
├─ build.sh                         # Compile Script
└─ README.md

Score

The teaching assistant changed the question, so there is no score.