To the Top
File:  root - text - article - 2019 - 10 - find-pythagorean-triplets.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 270 Views, 15936 Search Bots | 57 Words

Subscribe to Feed Burner | 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.


def findPythagoreanTriplets(nums):
# Fill this in.

print findPythagoreanTriplets([3, 12, 5, 13])
# True
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 270 Views, 15936 Search Bots | 57 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Problem: Sort Colors
  2. Two-Sum
  3. Staying on a Chess Board
  4. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  5. Daily Interview Problem: Room scheduling
  6. Find Missing Numbers in an Array
  7. Algorithm Interview Question: H-Index
  8. Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
  9. Skip the readings, focus on problems. And use all the hints!
  10. Patterns for breaking down questions you haven

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">