File: root - text - article - 2019 - 10 - find-pythagorean-triplets.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 554 Views, 20251 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 554 Views, 20251 Search Bots | 57 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Uber:
Given a list of numbers, find if there exists a pythagorean triplet in that list. A pythagorean triplet is 3 variables a, b, c where a^2 + b^2 = c^2
Example:
Input: [3, 5, 12, 5, 13]
Output: True
Here, 5^2 + 12^2 = 13^2.
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 554 Views, 20251 Search Bots | 57 Words Given a list of numbers, find if there exists a pythagorean triplet in that list. A pythagorean triplet is 3 variables a, b, c where a^2 + b^2 = c^2
Example:
Input: [3, 5, 12, 5, 13]
Output: True
Here, 5^2 + 12^2 = 13^2.
def findPythagoreanTriplets(nums):
# Fill this in.
print findPythagoreanTriplets([3, 12, 5, 13])
# True
Related Articles
- Generate All IP Addresses
- Sorting a list with 3 unique numbers
- Find the non-duplicate number
- Daily Interview Problem: Deepest Node in a Binary Tree
- Multitasking
- Daily Interview Question: Word Search
- Longest Substring Without Repeating Characters
- How to Play WAV music under DOS?
- Algorithm Interview: Smallest Number that is not a Sum of a Subset of List
- Daily Interview Question: Edit Distance
©2006~2024 SteakOverCooked - 0.0095 Seconds(s) - 1965.455 KB/s - 30 Online Memory: 491.35 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !