1037. Valid Boomerang LeetCode Solution
In this guide, you will get 1037. Valid Boomerang LeetCode Solution with the best time and space complexity. The solution to Valid Boomerang problem is provided in various programming languages like C++, Java, and Python. This will be helpful for you if you are preparing for placements, hackathons, interviews, or practice purposes. The solutions provided here are very easy to follow and include detailed explanations.
Table of Contents
- Problem Statement
- Complexity Analysis
- Valid Boomerang solution in C++
- Valid Boomerang solution in Java
- Valid Boomerang solution in Python
- Additional Resources

Problem Statement of Valid Boomerang
Given an array points where points[i] = [xi, yi] represents a point on the X-Y plane, return true if these points are a boomerang.
A boomerang is a set of three points that are all distinct and not in a straight line.
Example 1:
Input: points = [[1,1],[2,3],[3,2]]
Output: true
Example 2:
Input: points = [[1,1],[2,2],[3,3]]
Output: false
Constraints:
points.length == 3
points[i].length == 2
0 <= xi, yi <= 100
Complexity Analysis
- Time Complexity: O(1)
- Space Complexity: O(1)
1037. Valid Boomerang LeetCode Solution in C++
class Solution {
public:
bool isBoomerang(vector<vector<int>>& points) {
return (points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) !=
(points[1][1] - points[0][1]) * (points[2][0] - points[1][0]);
}
};
/* code provided by PROGIEZ */
1037. Valid Boomerang LeetCode Solution in Java
class Solution {
public boolean isBoomerang(int[][] points) {
return //
(points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) != //
(points[1][1] - points[0][1]) * (points[2][0] - points[1][0]);
}
}
// code provided by PROGIEZ
1037. Valid Boomerang LeetCode Solution in Python
class Solution:
def isBoomerang(self, points: list[list[int]]) -> bool:
return ((points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) !=
(points[1][1] - points[0][1]) * (points[2][0] - points[1][0]))
# code by PROGIEZ
Additional Resources
- Explore all LeetCode problem solutions at Progiez here
- Explore all problems on LeetCode website here
Happy Coding! Keep following PROGIEZ for more updates and solutions.