File: root - text - article - 2019 - 10 - find-pythagorean-triplets.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 548 Views, 20168 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 548 Views, 20168 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 | 548 Views, 20168 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
- Kaprekar
- Algorithm Interview: Make the Largest Number
- Daily Interview Problem: Find the Number of Islands
- Daily Interview Problem: Tree Serialization
- Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
- Progess made
- Daily Interview Problem: Word Ordering in a Different Alphabetical Order
- Reverse a Directed Graph
- 56 Bytes
- Skip the readings, focus on problems. And use all the hints!
©2006~2024 SteakOverCooked - 0.0103 Seconds(s) - 1720.881 KB/s - 39 Online Memory: 492.71 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 !