question_slug
stringlengths
3
77
title
stringlengths
1
183
slug
stringlengths
12
45
summary
stringlengths
1
160
author
stringlengths
2
30
certification
stringclasses
2 values
created_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
updated_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
hit_count
int64
0
10.6M
has_video
bool
2 classes
content
stringlengths
4
576k
upvotes
int64
0
11.5k
downvotes
int64
0
358
tags
stringlengths
2
193
comments
int64
0
2.56k
valid-boomerang
[Python 3] Triangle Area
python-3-triangle-area-by-hari19041-f8rr
Concept: We need to check if the 3 points are in a straight line or not.\nMath: We can find the area of the triangle formed by the three points and check if the
hari19041
NORMAL
2022-04-27T06:26:51.161700+00:00
2022-04-27T06:26:51.161744+00:00
3,143
false
**Concept:** We need to check if the 3 points are in a straight line or not.\nMath: We can find the area of the triangle formed by the three points and check if the area is non-zero.\n**DO UPVOTE IF YOU FOUND IT HELPFUL.**\n\n\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n x...
27
0
['Math', 'Python', 'Python3']
1
valid-boomerang
C++ Calculate Slopes!! (1 liner with explanation)
c-calculate-slopes-1-liner-with-explanat-zgvt
\tclass Solution {\n\tpublic:\n\t\tbool isBoomerang(vector>& points) {\n\t\t\tif(points.size() != 3)\n\t\t\t\treturn false;\n\n\t\t\t// formula for slope = (y2
ddev
NORMAL
2019-05-05T04:01:22.343792+00:00
2019-05-05T04:17:32.758644+00:00
2,325
false
\tclass Solution {\n\tpublic:\n\t\tbool isBoomerang(vector<vector<int>>& points) {\n\t\t\tif(points.size() != 3)\n\t\t\t\treturn false;\n\n\t\t\t// formula for slope = (y2 - y1)/(x2 - x1)\n\t\t\t// assume the slope of the line using points 0 and 1 (a/b) and that of using points 0 and 2 (c / d)\n\t\t\t// avoid dividing...
22
2
[]
3
valid-boomerang
[Java/Python 3] one liner - slopes of 2 edges are not equal.
javapython-3-one-liner-slopes-of-2-edges-6j7i
If the 3 points can form a triangle ABC, then the slopes of any 2 edges, such as AB and AC, are not equal.\n\nUse Formula as follows:\n\n(y0 - y1) / (x0 - x1) !
rock
NORMAL
2019-05-05T04:03:01.884186+00:00
2020-04-12T17:32:52.774133+00:00
2,139
false
If the 3 points can form a triangle ABC, then the slopes of any 2 edges, such as AB and AC, are not equal.\n\nUse Formula as follows:\n\n(y0 - y1) / (x0 - x1) != (y0 - y2) / (x0 - x2) => \n\n(x0 - x2) * (y0 - y1) != (x0 - x1) * (y0 - y2)\n\nWhere \nA:\nx0 = p[0][0]\ny0 = p[0][1]\nB:\nx1 = p[1][0]\ny1 = p[1][1]\nC:\nx2 ...
21
1
[]
2
valid-boomerang
🔥🔥Boomerang Check: Detecting Collinearity in 2D Points||Easy Solution🔥🔥
boomerang-check-detecting-collinearity-i-x1ir
Intuition\n Describe your first thoughts on how to solve this problem. \nThe approach involves using the formula for the slope of a line to determine if the giv
Aashiq_Edavalapati
NORMAL
2024-04-21T07:38:21.711434+00:00
2024-04-21T07:38:21.711467+00:00
993
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe approach involves using the formula for the slope of a line to determine if the given three points are collinear. For three points (x1, y1), (x2, y2), and (x3, y3), the slope of the line between (x1, y1) and (x2, y2) can be represente...
20
0
['Math', 'Java', 'Python3']
0
valid-boomerang
O(1) Valid Boomerang Solution in C++
o1-valid-boomerang-solution-in-c-by-the_-bo8r
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nSlopes are matched : (y
The_Kunal_Singh
NORMAL
2023-05-08T05:06:44.412131+00:00
2023-05-08T05:07:36.468883+00:00
1,303
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSlopes are matched : (y2-y1)/(x2-x1)\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(1)\n- Space complexity:\n<!-- Add your...
13
0
['C++']
0
valid-boomerang
Python, math solution, checking slopes
python-math-solution-checking-slopes-by-y1e7g
\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n (x0, y0), (x1, y1), (x2, y2) = points\n return (y2 - y1) * (x0 -
blue_sky5
NORMAL
2020-10-19T03:33:59.357801+00:00
2020-10-19T04:20:04.039730+00:00
1,306
false
```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n (x0, y0), (x1, y1), (x2, y2) = points\n return (y2 - y1) * (x0 - x1) != (x2 - x1) * (y0 - y1)\n```
11
1
['Python', 'Python3']
0
valid-boomerang
[c++] Full explanation(100% faster) || Using triangle rule
c-full-explanation100-faster-using-trian-8xjd
Example : [1,1] [2,3] [3,2]\nLets say:\n\n(x1,y1) = (1,1) \n(x2,y2) = (2,3) \n(x3,y3) = (3,2)\n\nif slopes of lines with any two point will be same , then they
Ved_Prakash1102
NORMAL
2021-01-11T07:00:30.274761+00:00
2021-01-12T03:32:57.707168+00:00
743
false
**Example : [1,1] [2,3] [3,2]**\nLets say:\n```\n(x1,y1) = (1,1) \n(x2,y2) = (2,3) \n(x3,y3) = (3,2)\n```\n**if slopes of lines with any two point will be same , then they are in straight line**\ni.e.\n```\nL1 = (points[0][0] - points[1][0])/(points[0][1]-points[1][1]);\nL2 = (points[0][0] - points[2][0])/(points[0][1]...
8
1
['C', 'C++']
0
valid-boomerang
Java 0ms solution
java-0ms-solution-by-spoorthi_raj-wqia
The above question makes it clear that a valid boomerang is a triangle. To find out if the given three points form a valid boomerang or not,we calculate the are
spoorthi_raj
NORMAL
2019-06-21T16:56:41.002765+00:00
2019-06-21T16:56:41.002811+00:00
978
false
The above question makes it clear that a valid boomerang is a triangle. To find out if the given three points form a valid boomerang or not,we calculate the area enclosed by those three points.Non zero area represents a valid boomerang.\n![image](https://assets.leetcode.com/users/spoorthi99/image_1561136151.png)\n\nCod...
8
1
[]
4
valid-boomerang
Java | Math | Faster Than 100% Java Submissions
java-math-faster-than-100-java-submissio-uy51
\nclass Solution {\n public boolean isBoomerang(int[][] p) {\n int x1=p[0][0];\n int y1=p[0][1];\n int x2=p[1][0];\n int y2=p[1][
Divyansh__26
NORMAL
2022-09-07T06:19:57.082653+00:00
2022-09-07T06:19:57.082711+00:00
1,241
false
```\nclass Solution {\n public boolean isBoomerang(int[][] p) {\n int x1=p[0][0];\n int y1=p[0][1];\n int x2=p[1][0];\n int y2=p[1][1];\n int x3=p[2][0];\n int y3=p[2][1];\n int area=x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);\n return area!=0;\n }\n}\n```\nKindly upv...
7
0
['Math', 'Java']
0
valid-boomerang
Simple Python code: calculate the line equation (with explanation)
simple-python-code-calculate-the-line-eq-2mnm
\n def isBoomerang(self, points):\n x0, y0 = points[0][0], points[0][1]\n x1, y1 = points[1][0], points[1][1]\n x2, y2 = points[2][0], poin
dr_sean
NORMAL
2019-05-06T19:41:17.424336+00:00
2019-05-06T20:34:19.032851+00:00
685
false
```\n def isBoomerang(self, points):\n x0, y0 = points[0][0], points[0][1]\n x1, y1 = points[1][0], points[1][1]\n x2, y2 = points[2][0], points[2][1]\n if [x0, y0] == [x1, y1] or [x0, y0] == [x2, y2] or [x1, y1] == [x2, y2]: return False\n if x0 == x1 == x2: return False\n if ...
7
2
[]
1
valid-boomerang
Simple Slope based approach O(1)
simple-slope-based-approach-o1-by-christ-3pnp
Slope of line going through (x1, y1) and (x2, y2) = (y1 - y2)/(x1 - x2)\nTwo lines are same if their slope is same\nso (y1 - y2)/(x1 - x2) = (y1- y3)/(x1 - x3)
christris
NORMAL
2019-05-05T04:39:26.265608+00:00
2019-05-05T04:39:26.265651+00:00
457
false
Slope of line going through (x1, y1) and (x2, y2) = (y1 - y2)/(x1 - x2)\nTwo lines are same if their slope is same\nso (y1 - y2)/(x1 - x2) = (y1- y3)/(x1 - x3)\nor (y1 - y2) * (x1 - x3) == (y1 - y3) * (x1 - x2); \nNot condition added as problem asks for if points are NOT on same line.\n\n``` csharp\npublic class So...
6
1
[]
0
valid-boomerang
Compare slopes python
compare-slopes-python-by-sunakshi132-tjop
To avoid division by zero instead of comparing (delta y1)/(delta x1) != (delta y2)/(delta x2), cross multiply: (delta y1) * (delta x2) != (delta y2) * (delta x1
sunakshi132
NORMAL
2022-08-01T23:21:19.293922+00:00
2022-08-01T23:23:35.996164+00:00
892
false
To avoid division by zero instead of comparing (delta y1)/(delta x1) != (delta y2)/(delta x2), cross multiply: (delta y1) * (delta x2) != (delta y2) * (delta x1)\n\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n a,b,c=points\n return (b[1]-a[1])*(c[0]-b[0]) != (c[1]-b[...
5
0
['Python', 'Python3']
0
valid-boomerang
Cross product
cross-product-by-interpunctus-vj2j
Cross product or vector product is another way:\n\n public bool IsBoomerang(int[][] points) {\n var x1 = points[0][0] - points[1][0]; \n var y1
interpunctus
NORMAL
2019-05-11T09:12:17.060185+00:00
2019-05-11T09:12:17.060230+00:00
529
false
Cross product or vector product is another way:\n```\n public bool IsBoomerang(int[][] points) {\n var x1 = points[0][0] - points[1][0]; \n var y1 = points[0][1] - points[1][1]; \n var x2 = points[0][0] - points[2][0]; \n var y2 = points[0][1] - points[2][1]; \n return (x1*y2 - x2*...
5
1
[]
0
valid-boomerang
💢☠💫Easiest👾Faster✅💯 Lesser🧠 🎯 C++✅Python3🐍✅Java✅C✅Python🐍✅C#✅💥🔥💫Explained☠💥🔥 Beats 💯
easiestfaster-lesser-cpython3javacpython-0stz
Intuition\n\n\n\n\n\n\nC++ []\nclass Solution {\npublic:\n static bool isBoomerang(vector<vector<int>>& points) {\n int x1 = points[0][0], y1 = points
Edwards310
NORMAL
2024-06-08T12:55:28.964555+00:00
2024-06-08T12:55:28.964588+00:00
928
false
# Intuition\n![0ehh83fsnh811.jpg](https://assets.leetcode.com/users/images/4647efee-c324-468b-a435-416d04b7d3cf_1717850944.8254216.jpeg)\n![Screenshot 2024-06-08 180857.png](https://assets.leetcode.com/users/images/dcc377f8-e5ed-4cf2-9bb1-78651dabae99_1717850953.2946217.png)\n![Screenshot 2024-06-08 180928.png](https:/...
4
0
['Array', 'Math', 'Geometry', 'C', 'Python', 'C++', 'Java', 'Python3', 'C#']
0
valid-boomerang
1 Line || Java Solution
1-line-java-solution-by-rtkush-4500
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
RtLavKush7
NORMAL
2024-03-18T15:13:16.861484+00:00
2024-03-18T15:13:16.861510+00:00
1,020
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
4
1
['Java']
0
valid-boomerang
✅EASY C++ NAIVE SOLUTION & BETTER ALGORITHM | 100% FASTER
easy-c-naive-solution-better-algorithm-1-tfpz
Algorithm 1:\n1. Calculate differences between points\n2. Cross multiply \n\ta. Second y-axis difference with first x-axis difference\n\tb. First y-axis differe
ke4e
NORMAL
2022-07-23T18:20:10.895801+00:00
2022-07-23T18:20:10.895851+00:00
395
false
Algorithm 1:\n1. Calculate differences between points\n2. Cross multiply \n\ta. Second y-axis difference with first x-axis difference\n\tb. First y-axis difference with second x-axis difference\n3. If they will be equal, it will return false(i.e. straight line) otherwise true (boomerang)\nNote: On cross multiplying, it...
4
0
['C']
0
valid-boomerang
just a simple solution by just using area of triangle || 0ms runtime
just-a-simple-solution-by-just-using-are-s81x
\nclass Solution {\n public boolean isBoomerang(int[][] p) {\n int x1=p[0][0];\n int y1=p[0][1];\n \n int x2=p[1][0];\n in
Rakesh_Sharma_4
NORMAL
2022-01-23T01:30:31.322670+00:00
2022-01-23T01:34:21.713328+00:00
124
false
```\nclass Solution {\n public boolean isBoomerang(int[][] p) {\n int x1=p[0][0];\n int y1=p[0][1];\n \n int x2=p[1][0];\n int y2=p[1][1];\n \n int x3=p[2][0];\n int y3=p[2][1];\n \n int area=x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);\n return area!...
4
6
['Java']
1
valid-boomerang
100 % Beats || Simple || One Line of Code
100-beats-simple-one-line-of-code-by-kdh-v1xt
IntuitionApproachComplexity Time complexity:O(1) Space complexity:O(1) Code
kdhakal
NORMAL
2025-03-26T15:22:16.368786+00:00
2025-03-26T15:22:16.368786+00:00
62
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity:O(1) <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity:O(1) <!-- Add your space complexity here, e.g. $$O(n)$$ --> ...
3
0
['Java']
0
valid-boomerang
C++ || sORo
c-soro-by-so-ro-yfid
Intuition\nGive it a dry run, you well get it.\n\n....\nhey you, yes you.. please do vote this up and let leetcode know you are enjoying what you are watching.\
sorohere
NORMAL
2023-07-27T11:11:15.800945+00:00
2023-07-27T11:11:15.800973+00:00
344
false
# Intuition\nGive it a ```dry run```, you well get it.\n\n....\nhey you, yes you.. please do vote this up and let leetcode know you are enjoying what you are watching.\n\n# Complexity\n- Time complexity: ```O(1)``` Constant Time.\n\n- Space complexity: ```O(1)``` Constant Space. \n\n# Code\n```\nclass Solution {\npubli...
3
0
['C++']
1
valid-boomerang
100% faster || One line || JAVA x GEOMETRY
100-faster-one-line-java-x-geometry-by-i-9oo1
Formula\n\n\n\nSo if three points are not collinear then they will be boomerang\n\n\n# Code\n\nclass Solution {\n public boolean isBoomerang(int[][] points)
im_obid
NORMAL
2023-04-21T05:07:15.858870+00:00
2023-04-21T05:07:15.858904+00:00
783
false
# Formula\n![image.png](https://assets.leetcode.com/users/images/4118f1c5-ddf9-4809-af3b-456e977259aa_1682053496.2263007.png)\n\n\nSo if three points are not ```collinear``` then they will be ```boomerang```\n\n\n# Code\n```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return !((points[0...
3
0
['Java']
1
valid-boomerang
Java 0ms solution. with explanation
java-0ms-solution-with-explanation-by-ob-pa6t
Intuition\n Describe your first thoughts on how to solve this problem. \nMy first thought is to check if the three points given form a straight line by checking
Obose
NORMAL
2023-01-19T17:21:15.055284+00:00
2023-01-19T17:21:15.055330+00:00
1,176
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nMy first thought is to check if the three points given form a straight line by checking the slope between each pair of points. If the slope between any two points is the same, then the points form a straight line and are not a boomerang.\...
3
0
['Java']
1
valid-boomerang
1 line 100% runtime
1-line-100-runtime-by-hurshidbek-yjma
\nPLEASE UPVOTE IF YOU LIKE.\n\n```\nreturn ( p[0][0] - p[1][0]) * (p[1][1] - p[2][1] ) !=\n ( p[1][0] - p[2][0]) * (p[0][1] - p[1][1] );\n
Hurshidbek
NORMAL
2022-07-28T08:49:30.973210+00:00
2022-08-20T13:28:52.758954+00:00
514
false
```\nPLEASE UPVOTE IF YOU LIKE.\n```\n```\nreturn ( p[0][0] - p[1][0]) * (p[1][1] - p[2][1] ) !=\n ( p[1][0] - p[2][0]) * (p[0][1] - p[1][1] );\n
3
0
['Array', 'Java']
0
valid-boomerang
valid-boomerang Java Solution
valid-boomerang-java-solution-by-nishant-n2c7
```java\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int a = points[1][1]-points[0][1];\n int b = points[1][0]-points[0][
nishant7372
NORMAL
2022-02-27T10:24:24.732785+00:00
2022-02-27T10:24:24.732824+00:00
214
false
```java\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int a = points[1][1]-points[0][1];\n int b = points[1][0]-points[0][0];\n int c = points[2][1]-points[1][1];\n int d = points[2][0]-points[1][0];\n if((a*d)!=(b*c))\n return true;\n return f...
3
0
[]
0
valid-boomerang
Rust solution
rust-solution-by-bigmih-b9hi
We can use formula:\n\n\nimpl Solution {\n pub fn is_boomerang(p: Vec<Vec<i32>>) -> bool {\n let (x0, y0) = (p[0][0], p[0][1]);\n let (x1, y1)
BigMih
NORMAL
2021-10-19T05:14:16.061182+00:00
2021-10-19T05:14:16.061220+00:00
149
false
We can use formula:\n![image](https://assets.leetcode.com/users/images/6d6e8055-fd28-4f0d-ad61-a05ca90401b7_1634620430.4364257.png)\n```\nimpl Solution {\n pub fn is_boomerang(p: Vec<Vec<i32>>) -> bool {\n let (x0, y0) = (p[0][0], p[0][1]);\n let (x1, y1) = (p[1][0], p[1][1]);\n let (x2, y2) = (...
3
0
['Math', 'Rust']
1
valid-boomerang
[C++] Solutions
c-solutions-by-zxspring21-j7p0
C++:\n(1) Intuition\n\nbool isBoomerang(vector<vector<int>>& points) {\n\tset<double> slope;\n\tfor(int i=0;i<3;++i){\n\t\tif(points[i%3][0]==points[(i+1)%3][0]
zxspring21
NORMAL
2020-10-13T02:31:00.192133+00:00
2020-10-13T02:32:50.496822+00:00
220
false
##### **C++:**\n**(1) Intuition**\n```\nbool isBoomerang(vector<vector<int>>& points) {\n\tset<double> slope;\n\tfor(int i=0;i<3;++i){\n\t\tif(points[i%3][0]==points[(i+1)%3][0]) slope.insert(DBL_MAX);\n\t\telse slope.insert( (double)(points[i][1]-points[(i+1)%3][1])/ (points[i][0]-points[(i+1)%3][0]) );\n\t}\n\tre...
3
0
['C']
0
valid-boomerang
Java comparing slope
java-comparing-slope-by-hobiter-888y
\n //make sure slope is not the same;\n // (a[1] - b[1]) / (a[0] - b[0]) != (c[1] - b[1]) / (c[0] - b[0]) \n // to avoid divid by zero error, transfer
hobiter
NORMAL
2020-09-14T05:18:13.056236+00:00
2020-09-14T05:18:13.056293+00:00
259
false
```\n //make sure slope is not the same;\n // (a[1] - b[1]) / (a[0] - b[0]) != (c[1] - b[1]) / (c[0] - b[0]) \n // to avoid divid by zero error, transfer to:\n // (a[1] - b[1]) * (c[0] - b[0]) != (c[1] - b[1]) * (a[0] - b[0])\n public boolean isBoomerang(int[][] ps) {\n int[] a = ps[0], b = ps[1...
3
0
[]
0
valid-boomerang
C++ | 4ms | 100% | Triangle Area
c-4ms-100-triangle-area-by-tushleo96-csch
\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n int x1 = points[0][0] ;\n int y1 = points[0][1] ;\n \n
tushleo96
NORMAL
2020-05-24T21:05:32.079154+00:00
2020-05-24T21:05:32.079190+00:00
267
false
```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n int x1 = points[0][0] ;\n int y1 = points[0][1] ;\n \n int x2 = points[1][0] ;\n int y2 = points[1][1] ;\n \n int x3 = points[2][0] ;\n int y3 = points[2][1] ;\n \n ...
3
0
['Math', 'C++']
0
valid-boomerang
Python 99.14% finding the distance between points
python-9914-finding-the-distance-between-p6en
\nclass Solution(object):\n def isBoomerang(self, points):\n """\n :type points: List[List[int]]\n :rtype: bool\n """\n A,
denyscoder
NORMAL
2019-09-06T19:52:43.717991+00:00
2019-09-06T19:54:03.340914+00:00
475
false
```\nclass Solution(object):\n def isBoomerang(self, points):\n """\n :type points: List[List[int]]\n :rtype: bool\n """\n A, B, C = points\n AB = ((A[0] - B[0])**2 + (A[1] - B[1])**2)**(0.5)\n BC = ((B[0] - C[0])**2 + (B[1] - C[1])**2)**(0.5)\n AC = ((A[0] - C...
3
3
['Math', 'Python', 'Python3']
0
valid-boomerang
Check the colinearlity condition of coordinate geometry .
check-the-colinearlity-condition-of-coor-5l3a
Intuitioncheck the collinearlity condition of the linesApproachsteps : for three points (x1,y1),(x2,y2),(x3,y3) will be collinear if they (y2-y1) x ( x3-x2) = (
abhisheks02
NORMAL
2025-03-31T20:52:49.859136+00:00
2025-03-31T20:52:49.859136+00:00
30
false
# Intuition check the collinearlity condition of the lines # Approach steps : for three points (x1,y1),(x2,y2),(x3,y3) will be collinear if they (y2-y1) x ( x3-x2) = (y3-y2) x ( x2 - x1) . Upvote krna nahi bhulna bro ! # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space ...
2
0
['C++']
0
valid-boomerang
EASY C++ 100% O(1) AREA
easy-c-100-o1-area-by-hnmali-t2jw
Complexity Time complexity: O(1) Aux. Space: O(1) Code
hnmali
NORMAL
2025-02-26T16:31:51.532364+00:00
2025-02-26T16:31:51.532364+00:00
123
false
# Complexity - Time complexity: $$O(1)$$ - Aux. Space: $$O(1)$$ # Code ```cpp [] class Solution { public: bool isBoomerang(vector<vector<int>>& pt) { int area = pt[0][0] * (pt[1][1] - pt[2][1]) + pt[1][0] * (pt[2][1] - pt[0][1]) + pt[2][0] * (pt[0][1] - pt[1][1]); ...
2
0
['Array', 'Math', 'Geometry', 'C++']
0
valid-boomerang
Best Approach.. | In O(1) Time Complexity..🚀
best-approach-in-o1-time-complexity-by-m-hr1h
Intuition\nI saw the concept of colinearity of the triangle and just applied the formula for area of triangle..\n\n# Approach\nFind out the area of triangle and
mansimittal935
NORMAL
2024-06-27T15:14:57.235102+00:00
2024-06-27T15:14:57.235131+00:00
62
false
# Intuition\nI saw the concept of colinearity of the triangle and just applied the formula for area of triangle..\n\n# Approach\nFind out the area of triangle and match if it is equal to zero or not..\n\n# Complexity\n- Time complexity:\n- O(1)\n\n- Space complexity:\n- O(1)\n\n# Code\n```\nclass Solution {\npublic:\n ...
2
0
['C++']
0
valid-boomerang
Easy one liner Java Solution
easy-one-liner-java-solution-by-ansh29-gqtk
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
AnsH29
NORMAL
2024-02-05T16:42:04.600408+00:00
2024-02-05T16:42:04.600426+00:00
530
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Java']
0
valid-boomerang
Maths Concept of Collinierity
maths-concept-of-collinierity-by-yashraj-p07g
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Yashrajsingh282
NORMAL
2023-10-26T15:29:21.984666+00:00
2023-10-26T15:29:21.984684+00:00
389
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Java']
0
valid-boomerang
O(1)
o1-by-deleted_user-szsp
\n# Code\n\n/**\n * @param {number[][]} points\n * @return {boolean}\n */\nvar isBoomerang = function(points) {\n // x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y
deleted_user
NORMAL
2023-07-16T18:40:51.909129+00:00
2023-07-16T18:40:51.909147+00:00
223
false
\n# Code\n```\n/**\n * @param {number[][]} points\n * @return {boolean}\n */\nvar isBoomerang = function(points) {\n // x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y2) = 0\n let [[x1, y1], [x2, y2], [x3, y3]] = points\n return x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) == 0 ? false : true\n};\n```
2
0
['JavaScript']
0
valid-boomerang
Python Super Easy
python-super-easy-by-h2k4082k-lp1h
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
h2k4082k
NORMAL
2023-01-30T14:57:39.426134+00:00
2023-01-30T14:57:39.426183+00:00
1,245
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Python3']
1
valid-boomerang
Easy to understand || C++
easy-to-understand-c-by-yashwardhan24_sh-saer
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
yashwardhan24_sharma
NORMAL
2023-01-02T06:09:00.855085+00:00
2023-01-02T06:09:00.855130+00:00
1,137
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['C++']
1
valid-boomerang
Easy and Well Understandable - C++ Beats 100% Efficient (Using only if statement)
easy-and-well-understandable-c-beats-100-ev2s
Code\n\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n int x1 = points[0][0] ;\n int y1 = points[0][1] ;\n
abhishektirkey
NORMAL
2023-01-01T15:27:39.751230+00:00
2023-01-01T15:27:39.751275+00:00
1,259
false
# Code\n```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n int x1 = points[0][0] ;\n int y1 = points[0][1] ;\n \n int x2 = points[1][0] ;\n int y2 = points[1][1] ;\n \n int x3 = points[2][0] ;\n int y3 = points[2][1] ;\n \...
2
0
['C++']
0
valid-boomerang
c++ | 100% faster | easy
c-100-faster-easy-by-venomhighs7-c5c1
\n\n# Code\n\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n return (p[0][0] - p[1][0]) * (p[0][1] - p[2][1]) != (p[0][0]
venomhighs7
NORMAL
2022-11-17T04:54:07.240065+00:00
2022-11-17T04:54:07.240129+00:00
835
false
\n\n# Code\n```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n return (p[0][0] - p[1][0]) * (p[0][1] - p[2][1]) != (p[0][0] - p[2][0]) * (p[0][1] - p[1][1]);\n }\n};\n```
2
0
['C++']
0
valid-boomerang
One Liner : Using Equation Of Line
one-liner-using-equation-of-line-by-ashu-u9lh
//Check Weather the points follow the equation of line or not if it follow return false else return true\nThe Equation of line is shown in figure you can see it
Ashutosh_2002
NORMAL
2022-09-22T13:55:13.051858+00:00
2022-09-22T13:55:13.051903+00:00
442
false
//Check Weather the points follow the equation of line or not if it follow return false else return true\nThe Equation of line is shown in figure you can see it and understood easly \n![image](https://assets.leetcode.com/users/images/9cfd853f-7916-4674-80ed-d02f26e721b8_1663854812.0551295.jpeg)\n\n\n``` \n bool isBo...
2
0
[]
0
valid-boomerang
【Hex】Python - Math
hex-python-math-by-hexuanweng-731z
Solution\nFormula: (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1)\n\npython\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n
HexuanWeng
NORMAL
2022-06-08T13:02:42.275969+00:00
2022-06-08T13:02:42.275999+00:00
305
false
## Solution\nFormula: (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1)\n\n```python\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n (x1, y1), (x2, y2), (x3, y3) = points\n return (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1)\n```
2
0
['Math']
0
valid-boomerang
✅ [C] || Simple Solution || O(1)
c-simple-solution-o1-by-bezlant-hgxw
\n\nThis is our formula, but we can\'t keep the "/" division to avoid dividing by ZERO.\n(y2 - y1) / (x2 - x1) != (y3 - y2) / (x3 - x2)\nSo it comes down to\n(y
bezlant
NORMAL
2022-04-14T06:28:28.631041+00:00
2022-04-14T06:28:28.631086+00:00
129
false
![image](https://assets.leetcode.com/users/images/a80e85c1-e4e6-4931-b5e1-d9172d237394_1649917448.5787466.png)\n\nThis is our formula, but we can\'t keep the "/" division to avoid dividing by ***ZERO***.\n**(y2 - y1) / (x2 - x1) != (y3 - y2) / (x3 - x2)**\n*So it comes down to*\n**(y2 - y1) * (x3 - x2) != (y3 - y2) * (...
2
0
['C']
0
valid-boomerang
Java Easy Solution
java-easy-solution-by-osb-379h
\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int x1 = points[0][0];\n int y1 = points[0][1];\n int x2 = points[1
osb
NORMAL
2022-03-08T08:40:58.573137+00:00
2022-03-08T08:40:58.573163+00:00
201
false
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int x1 = points[0][0];\n int y1 = points[0][1];\n int x2 = points[1][0];\n int y2 = points[1][1];\n int x3 = points[2][0];\n int y3 = points[2][1];\n \n if((y2-y1) * (x3-x2) != (x2-x1) * ...
2
0
['Math', 'Java']
0
valid-boomerang
Simple & Easy One Line Solution by Python 3
simple-easy-one-line-solution-by-python-77ihg
\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n return (points[1][1] - points[0][1]) * (points[2][0] - points[1][0]) !=
jamesujeon
NORMAL
2022-01-15T09:17:51.402464+00:00
2022-01-15T09:27:46.023282+00:00
192
false
```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n return (points[1][1] - points[0][1]) * (points[2][0] - points[1][0]) != (points[2][1] - points[1][1]) * (points[1][0] - points[0][0])\n```\n\nWhen the points are expressed like:\n- `(x0, y0) = (points[0][0], points[0][1])`\n- `(x...
2
0
['Python3']
0
valid-boomerang
Easy C++ solution
easy-c-solution-by-imran2018wahid-sipd
\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n // Check wheather the points are distinct or not\n if(points[0]
imran2018wahid
NORMAL
2021-12-26T07:51:53.182607+00:00
2021-12-26T07:51:53.182637+00:00
239
false
```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n // Check wheather the points are distinct or not\n if(points[0]==points[1] || points[1]==points[2] || points[2]==points[0]) {\n return false;\n }\n \n // Calculate the area of the triangle...
2
0
['C']
0
valid-boomerang
c++|Math|Geometry
cmathgeometry-by-abdullahalrifat-zs38
we just need to calculate the area of triangle with this 3 coordinates. if the total area is greater than 0 then it is boomerang else not.\narea = the absolute
abdullahalrifat
NORMAL
2021-12-07T06:14:23.052085+00:00
2021-12-07T06:14:23.052120+00:00
213
false
we just need to calculate the area of triangle with this 3 coordinates. if the total area is greater than 0 then it is boomerang else not.\n**area = the absolute value of Ax(By - Cy) + Bx(Cy - Ay) + Cx(Ay - By) divided by 2**\n```\nfloat area = abs((float)(points[0][0]*(points[1][1]-points[2][1])) +\n (floa...
2
0
['Geometry', 'C']
0
valid-boomerang
Rust - Colinearity check [0ms 2MB]
rust-colinearity-check-0ms-2mb-by-dimtio-o540
Underlying idea: if two vectors are colinear, their scalar product is equal to the product of their norm\n\nrust\nimpl Solution {\n pub fn is_boomerang(point
dimtion
NORMAL
2021-06-08T03:26:30.122987+00:00
2021-06-10T05:03:54.859036+00:00
109
false
Underlying idea: if two vectors are colinear, their scalar product is equal to the product of their norm\n\n```rust\nimpl Solution {\n pub fn is_boomerang(points: Vec<Vec<i32>>) -> bool {\n let a = (points[1][0] - points[0][0], points[1][1] - points[0][1]);\n let b = (points[2][0] - points[0][0], point...
2
0
['Rust']
0
valid-boomerang
C++ Solution using Slope Formula
c-solution-using-slope-formula-by-themat-pn5g
\n bool isBoomerang(vector<vector<int>>& points) {\n return (((points[1][1]-points[0][1]) * (points[2][0]-points[0][0])) != ((points[2][1]-points[0][1
TheMatrixNeo
NORMAL
2021-04-04T08:17:57.196118+00:00
2021-04-04T08:17:57.196155+00:00
117
false
```\n bool isBoomerang(vector<vector<int>>& points) {\n return (((points[1][1]-points[0][1]) * (points[2][0]-points[0][0])) != ((points[2][1]-points[0][1]) * (points[1][0]-points[0][0])));\n }\n```
2
0
[]
0
valid-boomerang
Simple Solution in Java | 100% Faster
simple-solution-in-java-100-faster-by-s3-qnr3
Checking if the points are collinear or not - by checking if sum of distance between any two points equal to the other. If they are linear (i.e. satisfies above
s34
NORMAL
2021-02-17T00:49:50.055218+00:00
2021-02-17T00:52:25.488163+00:00
117
false
Checking if the points are collinear or not - by checking if sum of distance between any two points equal to the other. If they are linear (i.e. satisfies above condition) such point exists, then it is a valid boomerang.\n\n```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n double d1=Math....
2
0
[]
0
valid-boomerang
My Python Solution
my-python-solution-by-vatamaniuk-fn6y
Hey guys, here\'s my solution for the problem.\n\n\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n\t\t#assigning the variables l
vatamaniuk
NORMAL
2021-01-10T19:21:11.216484+00:00
2021-01-10T19:21:56.901877+00:00
120
false
Hey guys, here\'s my solution for the problem.\n\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n\t\t#assigning the variables like this just makes it that much more readable imo\n [x1,y1],[x2,y2],[x3,y3] = points\n\t\t#i found this formula for area of a triangle with cartestia...
2
0
[]
0
valid-boomerang
Javascript | One liner
javascript-one-liner-by-surajjadhav7-ttad
\nvar isBoomerang = function([[ax,ay],[bx,by],[cx,cy]]) {\n return ((by-ay)*(cx-bx)!==(cy-by)*(bx-ax));\n};\n
surajjadhav7
NORMAL
2020-10-05T06:57:31.534539+00:00
2020-10-05T06:57:31.534583+00:00
424
false
```\nvar isBoomerang = function([[ax,ay],[bx,by],[cx,cy]]) {\n return ((by-ay)*(cx-bx)!==(cy-by)*(bx-ax));\n};\n```
2
0
['JavaScript']
1
valid-boomerang
Python | Area of triangle | beats 100%
python-area-of-triangle-beats-100-by-anu-5o5p
\nclass Solution:\n def isBoomerang(self, points: List[List[int]]):\n (x1,y1), (x2,y2), (x3,y3) = points\n return x1*(y2-y3) + x2*(y3-y1) + x3*
anuraggupta29
NORMAL
2020-09-23T06:45:09.197036+00:00
2020-09-23T06:45:09.197081+00:00
163
false
```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]):\n (x1,y1), (x2,y2), (x3,y3) = points\n return x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)\n```
2
0
[]
1
valid-boomerang
1 liner cpp solution
1-liner-cpp-solution-by-bitrish-mbor
If the triangle area formed by three points is 0 then they are collinear.\n\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n retur
bitrish
NORMAL
2020-09-16T15:31:54.228129+00:00
2020-09-16T15:31:54.228190+00:00
189
false
If the triangle area formed by three points is 0 then they are collinear.\n```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n return (p[0][0]*(p[1][1]-p[2][1]) - p[0][1]*(p[1][0]-p[2][0]) +(p[1][0]*p[2][1] - p[2][0]*p[1][1]))?true:false;\n }\n};\n```
2
0
['Math', 'C', 'C++']
0
valid-boomerang
simple python 🐍 solution beats Time 95% and Space 100% with comments
simple-python-solution-beats-time-95-and-ft5v
\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n #staright line if all x similar, all y similiar , or stairs [same cordin
injysarhan
NORMAL
2020-04-28T23:01:23.836930+00:00
2020-04-28T23:02:10.904890+00:00
298
false
```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n #staright line if all x similar, all y similiar , or stairs [same cordinates all of points] or 2 points are the same\n\t\t\n x1,y1=points[0][0],points[0][1]\n x2,y2=points[1][0],points[1][1]\n x3,y3=points[2]...
2
5
['Python', 'Python3']
1
valid-boomerang
Javascript and C++ solutions
javascript-and-c-solutions-by-claytonjwo-jhb5
Synopsis:\n\nCompare the slope of the first/second points and the first/third points. If they are not equal, then return true since the 3 points are not on the
claytonjwong
NORMAL
2020-04-21T23:17:01.430996+00:00
2020-04-21T23:17:31.401634+00:00
163
false
**Synopsis:**\n\nCompare the slope of the first/second points and the first/third points. If they are *not* equal, then return `true` since the 3 points are *not* on the same line, otherwise return `false`.\n\n---\n\n**1-liners:**\n\n*Javascript*\n```\nlet isBoomerang = A => (A[0][0] - A[1][0]) * (A[0][1] - A[2][1]) !...
2
0
[]
0
valid-boomerang
java one line beats 100%
java-one-line-beats-100-by-yanglin0883-0fj5
math formula\n"\'\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return (points[0][1] - points[1][1]) * (points[1][0] - points[2][
yanglin0883
NORMAL
2019-11-16T01:38:03.400573+00:00
2019-11-16T01:38:03.400614+00:00
344
false
math formula\n"\'\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return (points[0][1] - points[1][1]) * (points[1][0] - points[2][0]) !=(points[1][1] - points[2][1]) * (points[0][0] - points[1][0]);\n }\n}\n\'"
2
0
[]
0
valid-boomerang
One Line Code,Easy to understand
one-line-codeeasy-to-understand-by-tt294-w1l5
\n\npublic boolean isBoomerang(int[][] points) {\n\t\treturn (points[0][0] - points[1][0]) * (points[0][1] - points[2][1]) \n\t\t\t\t!= (points[0][0] - points[2
tt294127003
NORMAL
2019-08-15T06:20:58.146237+00:00
2019-08-15T06:20:58.146657+00:00
162
false
![image](https://assets.leetcode.com/users/tt294127003/image_1565850005.png)\n```\npublic boolean isBoomerang(int[][] points) {\n\t\treturn (points[0][0] - points[1][0]) * (points[0][1] - points[2][1]) \n\t\t\t\t!= (points[0][0] - points[2][0]) * (points[0][1] - points[1][1]);\n\t}\n```
2
1
[]
0
valid-boomerang
python solution
python-solution-by-ram_code-e5he
slope formula: y2-y1/x2-x1\n\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n X,Y,Z = points\n x1,y1 = X\n x
ram_code
NORMAL
2019-05-21T00:25:30.281443+00:00
2019-05-21T00:35:42.864081+00:00
257
false
**slope formula:** y2-y1/x2-x1\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n X,Y,Z = points\n x1,y1 = X\n x2,y2 = Y\n x3,y3 = Z\n return (X != Y or Y != Z or X != Z) and (y2-y1)*(x3-x2) != (y3-y2)*(x2-x1)\n```
2
1
[]
2
valid-boomerang
One line Java solution beats 100%
one-line-java-solution-beats-100-by-arju-uubs
We just need to check if the slopes are different. \ny0 - y1 / x0 - x1 != y0 - y2 / x0 - x2;\nbut 0/0 gives NaN hence we perform cross multiplication.\n\n\n\tpu
arjun_sharma
NORMAL
2019-05-09T05:15:04.994117+00:00
2019-05-09T05:18:40.646251+00:00
215
false
We just need to check if the slopes are different. \ny0 - y1 / x0 - x1 != y0 - y2 / x0 - x2;\nbut 0/0 gives NaN hence we perform cross multiplication.\n\n```\n\tpublic boolean isBoomerang(int[][] points) {\n return (points[0][1] - points[1][1]) * (points[0][0] - points[2][0]) != (points[0][1] - points[2][1]) * (...
2
1
[]
0
valid-boomerang
JavaScript beats 98.77% (rearranged slopes formula)
javascript-beats-9877-rearranged-slopes-3e6rv
If the two slopes are different, it is a boomerang. \nBut just simply calculating and comparing slopes can cause divide by zero issues.\n\nJust cross multipy th
beroa
NORMAL
2019-05-07T01:00:48.704889+00:00
2019-05-07T01:00:48.704953+00:00
276
false
If the two slopes are different, it is a boomerang. \nBut just simply calculating and comparing slopes can cause divide by zero issues.\n\nJust cross multipy the compare slopes formula: \n( y1-y0 / x1-x0 ) == ( y2-y1 / x2-x1 ) turns into ( y1-y0 )*( x2-x1 ) == ( x1-x0 )( y2-y1 ) \n\n```\n\tif ((points[1][1] - points[0]...
2
1
[]
1
valid-boomerang
Simple Java Solution (Rearrange slope check to avoid division by zero)
simple-java-solution-rearrange-slope-che-sbul
\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n if ((points[1][1]-points[0][1])*(points[2][0]-points[0][0])==(points[2][1]-points[
akashur
NORMAL
2019-05-06T10:54:33.708419+00:00
2019-05-06T10:54:33.708463+00:00
249
false
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n if ((points[1][1]-points[0][1])*(points[2][0]-points[0][0])==(points[2][1]-points[0][1])*(points[1][0]-points[0][0]))\n return false;\n return true;\n \n }\n}\n```\nSlope betwwen two points: (y1-y0)/(x1-x0)\nFor...
2
1
[]
0
valid-boomerang
Java one line solution
java-one-line-solution-by-zzz-clgp
start with calculating the slopes to any two lines formed by two points:\n\n public boolean isBoomerang(int[][] points) {\n if ((points[0][0] == point
zzz_
NORMAL
2019-05-05T07:02:53.124784+00:00
2019-05-05T07:11:39.291109+00:00
174
false
start with calculating the slopes to any two lines formed by two points:\n```\n public boolean isBoomerang(int[][] points) {\n if ((points[0][0] == points[1][0] && points[0][1] == points[1][1]) || (points[1][0] == points[2][0] && points[1][1] == points[2][1])) return false;\n return (double) (points[1]...
2
1
[]
0
valid-boomerang
1 Line Java.(Orientation)
1-line-javaorientation-by-poorvank-b8bc
Refer this.\n\n\n public boolean isBoomerang(int[][] points) {\n return ((points[1][1]-points[0][1])*(points[2][0]-points[1][0]) - (points[1][0]-points[0
poorvank
NORMAL
2019-05-05T04:01:49.769419+00:00
2019-05-05T04:05:23.628558+00:00
264
false
Refer [this](https://www.geeksforgeeks.org/orientation-3-ordered-points/).\n\n```\n public boolean isBoomerang(int[][] points) {\n return ((points[1][1]-points[0][1])*(points[2][0]-points[1][0]) - (points[1][0]-points[0][0])*(points[2][1]-points[1][1]))!=0;\n }\n```
2
2
[]
0
valid-boomerang
Simple 1-liner || Beats 100%
simple-1-liner-beats-100-by-vidhaan_j-95gr
IntuitionApproachComplexity Time complexity: O(1) Space complexity: O(1) Code
Vidhaan_J
NORMAL
2025-03-17T00:57:35.822967+00:00
2025-03-17T00:57:35.822967+00:00
57
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> I already knew the formula x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)!=0. So I just had to plug the points in. # Approach <!-- Describe your approach to solving the problem. --> I just plugged the points in with the formula. # Compl...
1
1
['Math', 'Python', 'Python3']
0
valid-boomerang
✅ 🔥 Beats 100% 🔥|| easy pizzy ✅ ||4 line code ✅ || O(1) ||
beats-100-easy-pizzy-4-line-code-o1-by-k-0kq1
Code
Krupa_133
NORMAL
2025-01-21T06:30:15.800337+00:00
2025-01-21T06:30:15.800337+00:00
171
false
![Screenshot from 2024-12-31 11-05-03.png](https://assets.leetcode.com/users/images/91d32c59-4e81-49a7-883d-344e13f7ff1f_1737441011.7619672.png) # Code ```python3 [] class Solution: def isBoomerang(self, points: List[List[int]]) -> bool: if points[0]==points[1] or points[0] == points[2] or points[1] == po...
1
0
['Python3']
0
valid-boomerang
Simple C solution
simple-c-solution-by-mukesh1855-kir6
\n# Approach\n Describe your approach to solving the problem. \nUsing simple geometry formula\n\n\n# Code\nc []\nbool isBoomerang(int** points, int pointsSize,
mukesh1855
NORMAL
2024-12-06T20:36:19.255699+00:00
2024-12-06T20:36:19.255759+00:00
43
false
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUsing simple geometry formula\n\n![image.png](https://assets.leetcode.com/users/images/34bba4e4-ba9e-4a7d-b0c1-3bc41e329efc_1733517317.444612.png)\n# Code\n```c []\nbool isBoomerang(int** points, int pointsSize, int* pointsColSize) {\n int x1 = p...
1
0
['C']
0
valid-boomerang
Easy⚡O(1)🗿simple solution💡with step by step procedure with
easyo1simple-solutionwith-step-by-step-p-x3wp
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
shamnad_skr
NORMAL
2024-11-27T15:49:50.439825+00:00
2024-11-27T15:49:50.439876+00:00
99
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O...
1
0
['TypeScript', 'JavaScript']
0
valid-boomerang
Easy solution
easy-solution-by-harshitaggarwal026-9n5c
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
harshitagg14
NORMAL
2024-09-10T19:22:16.422708+00:00
2024-09-10T19:22:16.422740+00:00
118
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['Java']
0
valid-boomerang
Simple java code 0 ms beats 100 %
simple-java-code-0-ms-beats-100-by-arobh-oxt0
\n# Complexity\n\n# Code\n\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int xm012=points[1][1]-points[0][1];\n xm012=xm01
Arobh
NORMAL
2024-03-21T13:28:31.964497+00:00
2024-03-21T13:28:31.964520+00:00
133
false
\n# Complexity\n![image.png](https://assets.leetcode.com/users/images/ccd38473-ba64-4a06-9b14-d68f38fa59d0_1711027685.8257945.png)\n# Code\n```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int xm012=points[1][1]-points[0][1];\n xm012=xm012*(points[2][0]-points[1][0]);\n int...
1
0
['Array', 'Math', 'Geometry', 'Java']
0
valid-boomerang
C# Solution
c-solution-by-panaeimi-xtf1
Code\n\npublic class Solution {\n public bool IsBoomerang(int[][] points) {\n int x1 = points[0][0], y1 = points[0][1]; \n int x2 = points[
panaeimi
NORMAL
2023-07-05T21:26:50.184091+00:00
2023-07-05T21:26:50.184108+00:00
27
false
# Code\n```\npublic class Solution {\n public bool IsBoomerang(int[][] points) {\n int x1 = points[0][0], y1 = points[0][1]; \n int x2 = points[1][0], y2 = points[1][1]; \n int x3 = points[2][0], y3 = points[2][1]; \n\n return (y2 - y1) * (x3 - x1) != (y3- y1) * (x2 - x1); \n ...
1
0
['C#']
0
valid-boomerang
Python solution
python-solution-by-dmitry_nagorniy-c1d3
Code\n\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n if ((points[2][0] - points[0][0]) * (points[1][1] - points[0][1]))
Dmitry_Nagorniy
NORMAL
2022-12-25T09:47:57.011806+00:00
2022-12-25T09:47:57.011845+00:00
102
false
# Code\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n if ((points[2][0] - points[0][0]) * (points[1][1] - points[0][1])) != (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]):\n return 1\n```
1
0
['Python3']
0
valid-boomerang
100% fast soln with 98% memory efficiency
100-fast-soln-with-98-memory-efficiency-ul8k9
bool isBoomerang(vector>& points) {\n\t\tint x1=points[0][0], x2=points[1][0], x3=points[2][0];\n int y1=points[0][1], y2=points[1][1], y3=points[2][1];\
jainshreyansh163
NORMAL
2022-09-23T16:36:56.011553+00:00
2022-09-23T16:36:56.011590+00:00
158
false
bool isBoomerang(vector<vector<int>>& points) {\n\t\tint x1=points[0][0], x2=points[1][0], x3=points[2][0];\n int y1=points[0][1], y2=points[1][1], y3=points[2][1];\n if(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)==0) return false;\n return true;\n }
1
0
[]
1
valid-boomerang
📌Fastest & easy Java☕ solution 0ms💯
fastest-easy-java-solution-0ms-by-saurab-5wy9
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return (points[0][0]-points[1][0])(points[2][1]-points[0][1])!=(points[0][1]-p
saurabh_173
NORMAL
2022-06-29T11:44:52.037998+00:00
2022-06-29T11:44:52.038029+00:00
88
false
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return (points[0][0]-points[1][0])*(points[2][1]-points[0][1])!=(points[0][1]-points[1][1])*(points[2][0]-points[0][0]);\n }\n}
1
0
[]
0
valid-boomerang
C#
c-by-neildeng0705-66qe
public bool IsBoomerang(int[][] points) {\n \n \n return points[0][0] * (points[1][1] - points[2][1]) + points[1][0] * (points[2][1] - poi
neildeng0705
NORMAL
2022-04-01T22:08:23.538012+00:00
2022-04-01T22:08:23.538051+00:00
93
false
public bool IsBoomerang(int[][] points) {\n \n \n return points[0][0] * (points[1][1] - points[2][1]) + points[1][0] * (points[2][1] - points[0][1]) + points[2][0] * (points[0][1] - points[1][1]) != 0;\n }
1
0
[]
1
valid-boomerang
Go area of triangle
go-area-of-triangle-by-dchooyc-m17d
Area of Triangle in Coordinate Geometry\n\n(\u0394ABC) = (1/2) | x1 (y2 \u2013 y3 ) + x2 (y3 \u2013 y1 ) + x3(y1 \u2013 y2) |\n\nIf the three coordinates are a
dchooyc
NORMAL
2022-03-09T01:50:29.714695+00:00
2022-03-09T01:50:29.714728+00:00
130
false
[Area of Triangle in Coordinate Geometry](https://www.cuemath.com/geometry/area-of-triangle-in-coordinate-geometry/)\n\n```(\u0394ABC) = (1/2) | x1 (y2 \u2013 y3 ) + x2 (y3 \u2013 y1 ) + x3(y1 \u2013 y2) |```\n\nIf the three coordinates are along the same line, the area of the three coordinates must be zero.\n\n```\nf...
1
0
['Go']
0
valid-boomerang
100.00% faster and 100.00% less memory in PHP
10000-faster-and-10000-less-memory-in-ph-im13
\nfunction isBoomerang($points){\n $a = $points[0][0] - $points[1][0];\n $b = $points[0][1] - $points[1][1];\n $c = $points[0][0] - $points
tusharGore26
NORMAL
2022-02-23T12:02:10.425144+00:00
2022-02-23T12:02:10.425253+00:00
51
false
```\nfunction isBoomerang($points){\n $a = $points[0][0] - $points[1][0];\n $b = $points[0][1] - $points[1][1];\n $c = $points[0][0] - $points[2][0];\n $d = $points[0][1] - $points[2][1];\n if($a*$d - $b*$c == 0) return false;\n return true;\n }\n\t```
1
0
['PHP']
0
valid-boomerang
Easy mathematics solution || Area of triangle
easy-mathematics-solution-area-of-triang-9nnk
If three points are colinear than the area of triangle formed by these points will be zero always.\n\n\nclass Solution:\n def isBoomerang(self, points: List[
amit_101
NORMAL
2022-02-02T22:06:17.848903+00:00
2022-02-02T22:08:53.270538+00:00
215
false
If three points are colinear than the area of triangle formed by these points will be zero always.\n\n```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n temp1 = points[0][0]*(points[1][1] - points[2][1]) \n temp2 = points[1][0]*(points[2][1] - points[0][1])\n temp3...
1
0
['Math', 'Python']
0
valid-boomerang
c++,easy collinear
ceasy-collinear-by-aksh-99-bwod
```\nclass Solution {\npublic:\n bool isBoomerang(vector>& p) {\n int t=p[0][0](p[1][1]-p[2][1])+p[1][0](p[2][1]-p[0][1])+p[2][0]*(p[0][1]-p[1][1]);\n
aksh-99
NORMAL
2021-12-04T14:58:37.932374+00:00
2021-12-04T14:58:37.932400+00:00
79
false
```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n int t=p[0][0]*(p[1][1]-p[2][1])+p[1][0]*(p[2][1]-p[0][1])+p[2][0]*(p[0][1]-p[1][1]);\n if(t==0)return false;\n return true;\n }\n};
1
0
['Math']
0
valid-boomerang
Javascript, calculate if points are not collinear
javascript-calculate-if-points-are-not-c-irps
\nconst isBoomerang = p => !isCollinear(...p);\n\nfunction isCollinear(a, b, c) {\n const p1 = [b[0] - a[0], b[1] - a[1]];\n const p2 = [c[0] - a[0], c[1] - a
a8e
NORMAL
2021-12-01T22:19:03.711664+00:00
2021-12-01T22:19:03.711704+00:00
155
false
```\nconst isBoomerang = p => !isCollinear(...p);\n\nfunction isCollinear(a, b, c) {\n const p1 = [b[0] - a[0], b[1] - a[1]];\n const p2 = [c[0] - a[0], c[1] - a[1]];\n\n return crossProduct(p1, p2) === 0;\n}\n\nfunction crossProduct(p1, p2) {\n return p1[0] * p2[1] - p2[0] * p1[1];\n}\n```
1
0
['JavaScript']
1
valid-boomerang
C++ Solution | One Line of code ! check collinearity
c-solution-one-line-of-code-check-collin-la2y
\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& pts) {\n return (pts[0][0]*(pts[1][1]-pts[2][1]))+(pts[1][0]*(pts[2][1]-pts[0][1])
rac101ran
NORMAL
2021-10-12T19:48:04.242783+00:00
2021-10-12T19:49:20.038628+00:00
183
false
```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& pts) {\n return (pts[0][0]*(pts[1][1]-pts[2][1]))+(pts[1][0]*(pts[2][1]-pts[0][1]))+(pts[2][0]*(pts[0][1]-pts[1][1]));\n }\n};\n```
1
0
['Math', 'Geometry', 'C']
0
valid-boomerang
Simple Java solution
simple-java-solution-by-mtuzmen-gfhi
I think this question was very useless. Nevertheless, below is my code. I think it can still be improved for that it can be made more generic to make it work if
mtuzmen
NORMAL
2021-09-23T21:11:09.509228+00:00
2021-09-23T21:11:31.469181+00:00
191
false
I think this question was very useless. Nevertheless, below is my code. I think it can still be improved for that it can be made more generic to make it work if there are more than 3 points. But, I hope it may be helpful for now. Good luck to everybody. \n\n if (points.length != 3 || points[0].length != 2) return fa...
1
0
['Java']
0
valid-boomerang
Swift | Valid Boomerang | One-liner (Vector Cross Product)
swift-valid-boomerang-one-liner-vector-c-ymr8
This solution uses the fact that the cross product of two colinear vectors is 0.\nIt subtracts the first point from each of the other points to create two vectr
iosdevzone
NORMAL
2021-08-31T23:08:53.408689+00:00
2021-09-03T17:41:51.614057+00:00
150
false
This solution uses the fact that the cross product of two colinear vectors is 0.\nIt subtracts the first point from each of the other points to create two vectrs and then calculates the cross product between the vectors.\n```swift\nclass Solution {\n func isBoomerang(_ p: [[Int]]) -> Bool {\n (p[1][0]-p[0][0]...
1
0
['Swift']
0
valid-boomerang
Easy C++, formula to check collinearity of three points
easy-c-formula-to-check-collinearity-of-njhi0
\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n return((0.5*(p[0][0]*(p[1][1]-p[2][1]) + p[1][0]*(p[2][1]-p[0][1]) + p[2][0
sharmishtha2401
NORMAL
2021-08-28T10:12:20.549757+00:00
2021-08-28T10:17:26.244319+00:00
144
false
```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n return((0.5*(p[0][0]*(p[1][1]-p[2][1]) + p[1][0]*(p[2][1]-p[0][1]) + p[2][0]*(p[0][1]-p[1][1])))!=0);\n }\n};\n\n/*\nFormula for area of triangle is : \n0.5 * [x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)]\n if area of triang...
1
0
[]
0
valid-boomerang
java solution(0 ms)
java-solution0-ms-by-user6640dw-smyj
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n \n int x1=points[0][0];\n int x2=points[1][0];\n int x3=point
user6640dw
NORMAL
2021-08-15T14:38:08.665529+00:00
2021-08-15T14:38:08.665559+00:00
120
false
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n \n int x1=points[0][0];\n int x2=points[1][0];\n int x3=points[2][0];\n int y1=points[0][1];\n int y2=points[1][1];\n int y3=points[2][1];\n int left=(y3-y1)*(x2-x1);\n int right=(x3-x1)...
1
0
[]
0
valid-boomerang
Java - vector cross product should not be zero - 0 ms
java-vector-cross-product-should-not-be-k7bg9
\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int dx1 = points[1][0] - points[0][0];\n int dy1 = points[1][1] - points[0]
cpp_to_java
NORMAL
2021-08-05T09:56:35.034483+00:00
2021-08-05T09:56:35.034527+00:00
66
false
```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n int dx1 = points[1][0] - points[0][0];\n int dy1 = points[1][1] - points[0][1];\n \n int dx2 = points[2][0] - points[0][0];\n int dy2 = points[2][1] - points[0][1];\n \n return (dx1*dy2 != dx2*dy1)...
1
0
[]
0
valid-boomerang
simple of simple
simple-of-simple-by-seunggabi-dzp1
python\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n def d(p1, p2):\n dy = p1[1] - p2[1]\n dx = p
seunggabi
NORMAL
2021-08-04T20:38:51.995581+00:00
2021-08-04T20:38:51.995623+00:00
160
false
```python\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n def d(p1, p2):\n dy = p1[1] - p2[1]\n dx = p1[0] - p2[0]\n \n try:\n return dy / dx\n except:\n return 0\n \n p = points...
1
0
['Python']
0
valid-boomerang
Java 4 line solution
java-4-line-solution-by-yashashvibhadaur-b827
class Solution {\n public boolean isBoomerang(int[][] points) {\n if(points[0][0](points[1][1]-points[2][1])+points[1][0](points[2][1]-points[0][1])+p
yashashvibhadauria6555
NORMAL
2021-07-11T18:43:54.252277+00:00
2021-07-11T18:44:26.834611+00:00
172
false
class Solution {\n public boolean isBoomerang(int[][] points) {\n if(points[0][0]*(points[1][1]-points[2][1])+points[1][0]*(points[2][1]-points[0][1])+points[2][0]*(points[0][1]-points[1][1])==0)\n return false;\n else\n return true;\n }\n}\n\n\n**Description:**\nLet P(x1, y1) ...
1
0
['Math', 'Java']
0
valid-boomerang
🪃 Swift: Valid Boomerang [4 ms, 100%] (+ Test Cases)
swift-valid-boomerang-4-ms-100-test-case-9r5m
Solution at July 6, 2021\n\nswift\nclass Solution {\n func isBoomerang(_ points: [[Int]]) -> Bool {\n guard Set(points).count >= 3 else { return false
AsahiOcean
NORMAL
2021-07-05T22:33:25.104539+00:00
2021-07-05T22:33:25.104578+00:00
1,078
false
**Solution at July 6, 2021**\n\n```swift\nclass Solution {\n func isBoomerang(_ points: [[Int]]) -> Bool {\n guard Set(points).count >= 3 else { return false }\n \n let points = points.map { [Double($0[0] + 1), Double($0[1] + 1)] }\n func f(_ a: Int,_ b: Int,_ c: Int,_ d: Int) -> Double {...
1
0
['Swift']
0
valid-boomerang
C++| EASY TO UNDERSTAND | fast and efficient using determinants
c-easy-to-understand-fast-and-efficient-n7eyq
Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome\n\nclass Sol
aarindey
NORMAL
2021-06-13T16:34:11.707436+00:00
2021-06-13T20:53:19.123070+00:00
162
false
**Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome**\n```\nclass Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& p) {\n int det;\n if(p[0]==p[1]||p[1]==p[2]||p[2]==p[0])\n return false;...
1
1
['Math', 'C']
0
valid-boomerang
Python3 simple "one-liner" solution
python3-simple-one-liner-solution-by-ekl-em3t
\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n return (points[1][1]-points[0][1]) * (points[2][0]-points[1][0]) != (poi
EklavyaJoshi
NORMAL
2021-06-11T02:41:45.041080+00:00
2021-06-11T02:52:50.017940+00:00
193
false
```\nclass Solution:\n def isBoomerang(self, points: List[List[int]]) -> bool:\n return (points[1][1]-points[0][1]) * (points[2][0]-points[1][0]) != (points[1][0]-points[0][0]) * (points[2][1]-points[1][1])\n```\n**If you like this solution, please upvote for this**
1
0
['Python3']
0
valid-boomerang
Java solution faster than 100%
java-solution-faster-than-100-by-nandini-nf8u
\nclass Solution {\n public boolean isBoomerang(int[][] coordinates) {\n int y1=coordinates[0][1];\n int x1=coordinates[0][0];\n int y2
nandini_awtani
NORMAL
2021-06-06T14:26:04.057854+00:00
2021-06-06T14:26:04.057882+00:00
111
false
```\nclass Solution {\n public boolean isBoomerang(int[][] coordinates) {\n int y1=coordinates[0][1];\n int x1=coordinates[0][0];\n int y2=coordinates[1][1];\n int x2=coordinates[1][0];\n for(int i=2;i<coordinates.length;i++)\n {\n int x3 = coordinates[i][0];\n ...
1
0
[]
1
valid-boomerang
Java | 0ms | 100%faster
java-0ms-100faster-by-aish9-p5ui
\nCalculate the area of the triangle: x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) and compare it with zero.\n\nclass Solution {\n public boolean isBoome
aish9
NORMAL
2021-06-03T04:23:22.109234+00:00
2021-06-03T04:23:22.109274+00:00
140
false
![image](https://assets.leetcode.com/users/images/432d1eac-b085-4d94-938c-a64ea1268a7b_1622694135.2419376.png)\nCalculate the area of the triangle: x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) and compare it with zero.\n```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n return points[0]...
1
1
['Java']
0
valid-boomerang
1 line with explanation in commnbts java | CPP
1-line-with-explanation-in-commnbts-java-2hgq
JAVA\n\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n /****\n \n Very simple\n 1. We know the line equation p
kanna17vce
NORMAL
2021-05-17T08:18:53.720373+00:00
2021-05-17T08:18:53.720407+00:00
155
false
JAVA\n```\nclass Solution {\n public boolean isBoomerang(int[][] points) {\n /****\n \n Very simple\n 1. We know the line equation passin through points A(x1,y1) and B(x2,y2) as \n y-y1= (y2-y1)*(x-x1)/(x2-x1)\n cross multuply with (x2-x1)\n (y-y1)(x2-x1)=(y2-y1)(x-x1...
1
0
['C++', 'Java']
0
valid-boomerang
Java Solution Using Slope of Lines
java-solution-using-slope-of-lines-by-de-vgov
\n public boolean isBoomerang(int[][] points) {\n double m1 = (points[1][1] - points[0][1]) * (points[2][0] - points[0][0]);\n double m2 = (points
demon_1997
NORMAL
2021-04-28T23:53:22.676461+00:00
2021-04-28T23:53:22.676501+00:00
156
false
```\n public boolean isBoomerang(int[][] points) {\n double m1 = (points[1][1] - points[0][1]) * (points[2][0] - points[0][0]);\n double m2 = (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]);\n return m1 != m2;\n }\n```
1
0
[]
1
valid-boomerang
c++(0ms 100%) equation of line
c0ms-100-equation-of-line-by-zx007pi-rvsj
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Valid Boomerang.\nMemory Usage: 10.3 MB, less than 51.56% of C++ online submissions for Valid B
zx007pi
NORMAL
2021-04-14T13:43:09.820378+00:00
2021-04-14T13:46:42.373337+00:00
218
false
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Valid Boomerang.\nMemory Usage: 10.3 MB, less than 51.56% of C++ online submissions for Valid Boomerang.\n**General idea:**\n1. equation of line for three points : (x-x1)/(x2-x1) = (y-y1)/(y2-y1) transform into:\n(x-x1) * (y2-y1) = (y-y1) * (x2-x1) (for ...
1
0
['C', 'C++']
0
valid-boomerang
Python calculate area of triangle
python-calculate-area-of-triangle-by-mxm-4gdg
Ugly solution. Since False == 0 and True != 0 we can just return the area directly.\npython\n\tdef isBoomerang(self, points: List[List[int]]) -> bool:\n
mxmb
NORMAL
2021-04-02T00:36:25.817797+00:00
2021-04-02T00:41:20.494210+00:00
258
false
Ugly solution. Since `False == 0` and `True != 0` we can just return the area directly.\n```python\n\tdef isBoomerang(self, points: List[List[int]]) -> bool:\n def areaOfTriangle():\n x, y = [point[0] for point in points], [point[1] for point in points]\n return (x[0]*y[1]+x[1]*y[2]+x[2]*y[...
1
1
['Python', 'Python3']
0
valid-boomerang
JAVA SOLUTION 100 % FASTER
java-solution-100-faster-by-aniket7419-005t
\nclass Solution {\n public boolean isBoomerang(int[][] point) {\n if(point[0][0]==point[1][0]&&point[0][1]==point[1][1])\n return false;\n
aniket7419
NORMAL
2021-01-21T18:32:57.998544+00:00
2021-01-21T18:32:57.998588+00:00
91
false
```\nclass Solution {\n public boolean isBoomerang(int[][] point) {\n if(point[0][0]==point[1][0]&&point[0][1]==point[1][1])\n return false;\n if(point[1][0]==point[2][0]&&point[1][1]==point[2][1])\n return false;\n if(point[0][0]==point[2][0]&&point[0][1]==point[2][1])\n...
1
0
[]
0
valid-boomerang
[c++ solution] explanation using slope fourmula
c-solution-explanation-using-slope-fourm-nqn2
we all know the slope fourmula , if slope between points(0) ,points(1) & points(1), points (2) is same then they are in a straight line .\nslope of 2 points :\n
0x1h0b
NORMAL
2020-12-07T15:35:48.544511+00:00
2020-12-07T15:35:48.544556+00:00
103
false
we all know the slope fourmula , if slope between points(0) ,points(1) & points(1), points (2) is same then they are in a straight line .\nslope of 2 points :\n `( y2-y1) / (x2-x1)` .... here if all 3 points are in straight line if \n \n `(y2-y1) / (x2-x1) = (y3-y2) / (x3-x2)` \n\nso just `return (y2-y1)*(x3...
1
1
['C']
0
valid-boomerang
Solution in Java, Using Determinants, 100%, 0ms, with Explanation
solution-in-java-using-determinants-100-jfeuq
\n// Recall the determinant property that for 3 points we can find the area of triangle using determinants\n// Also there is another property that if points are
johnwwk
NORMAL
2020-11-29T07:44:13.319110+00:00
2020-11-29T07:44:28.160568+00:00
105
false
```\n// Recall the determinant property that for 3 points we can find the area of triangle using determinants\n// Also there is another property that if points are colinear their determinant is zero\n//\n// x y 1\n// | x0 y0 1 |\n// | x1 y1 1 | = x0(y1-y2) - x1(y0-y2) + x2(y0-y1)\n// | x2 y2 1 |\nc...
1
0
[]
0
number-of-ways-to-stay-in-the-same-place-after-some-steps
Very simple and easy to understand java solution
very-simple-and-easy-to-understand-java-0bpo1
If we choose our dp state as dp[steps][position], from this state we can either:\n Stay. Then we consume one step and stay at the same position => dp[steps-1][p
renato4
NORMAL
2019-11-26T02:05:22.540208+00:00
2019-11-26T02:08:44.232679+00:00
8,744
false
If we choose our dp state as `dp[steps][position]`, from this state we can either:\n* Stay. Then we consume one step and stay at the same position => `dp[steps-1][position]`\n* Go right. Then we consume one step and go right => `dp[steps-1][position+1]`\n* Go left (if not at position zero). Then we consume one step and...
124
3
[]
22
number-of-ways-to-stay-in-the-same-place-after-some-steps
[C++] Recursive DP (Memoization)
c-recursive-dp-memoization-by-phoenixdd-yasr
Observation\nWe can use a simple DFS/recursion to form the solution.\nThe key observation is that we can prune all the positions where i>steps as we can never r
phoenixdd
NORMAL
2019-11-24T04:01:10.365846+00:00
2019-11-25T07:52:23.165983+00:00
12,593
false
**Observation**\nWe can use a simple DFS/recursion to form the solution.\nThe key observation is that we can prune all the positions where `i>steps` as we can never reach `0` in that case.\nWe can now use memoization to cache all our answers, the only thing we need to worry about is memory which can be solved by using ...
112
3
[]
12