7 kyu
Quadrants 2: Segments
217 of 892EntityPlantt
Description:
Task
Your task is to check whether a segment is completely in one quadrant or it crosses more.
Return true
if the segment lies in two or more quadrants.
If the segment lies within only one quadrant, return false
.
There are two parameters: A
(coord) and B
(coord), the endpoints defining the segment AB
.
No coordinate will be zero; expect that all X and Y are positive or negative.
Examples
- This whole segment is in the first quadrant.
[(1, 2), (3, 4)] -> false
- This segment intersects the Y axis, therefore being in two quadrants: I and II.
[(9, 3), (-1, 6)] -> true
- This segment is completely in the second quadrant.
[(-1, 6), (-9, 1)] -> false
Predefined
There is a class named coord
/Coord
(see in code). It has the following members:
(constructor)
: Constructs the coordinatex
(number): The X coordinatey
(number): The Y coordinate
x
(number): The X coordinatey
(number): The Y coordinate
operator==
(bool): Compares two coordinates if they're the samestr
(string): Turns coordinate into string
Task Series
- Quadrants
- Quadrants 2: Segments (this kata)
Fundamentals
Mathematics
Geometry
Similar Kata:
Stats:
Created | Apr 18, 2023 |
Published | Apr 19, 2023 |
Warriors Trained | 1903 |
Total Skips | 33 |
Total Code Submissions | 2462 |
Total Times Completed | 892 |
C++ Completions | 217 |
JavaScript Completions | 230 |
TypeScript Completions | 50 |
Python Completions | 382 |
C Completions | 94 |
Total Stars | 21 |
% of votes with a positive feedback rating | 89% of 150 |
Total "Very Satisfied" Votes | 123 |
Total "Somewhat Satisfied" Votes | 22 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 25 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |