File: root - text - article - 2019 - 10 - find-pythagorean-triplets.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 572 Views, 21379 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 572 Views, 21379 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 | 572 Views, 21379 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
- Daily Interview Question: Word Search
- [Daily Problem] Longest Increasing Subsequence
- Fix Brackets
- Sorting a list with 3 unique numbers
- Find the non-duplicate number
- Spreadsheet Columns
- Algorithm Interview Question: H-Index
- Algorithm Interview: Subarray With Target Sum
- Algorithm Interview: Convert Roman Numerals to Decimal
- Daily Interview Question: Create a Simple Calculator
©2006~2024 SteakOverCooked - 0.00697 Seconds(s) - 2714.729 KB/s - 11 Online Memory: 493.29 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="index, 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 !