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 | 269 Views, 15604 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 | 269 Views, 15604 Search Bots | 57 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Puzzle: Minimum Size Subarray Sum
  2. How to Play WAV music under DOS?
  3. Daily Interview Problem: Group Words that are Anagrams
  4. Daily Interview Problem: Merge K Sorted Linked Lists
  5. Spreadsheet Columns
  6. Non-decreasing Array with Single Modification
  7. Daily Interview Problem: Circle of Chained Words
  8. Daily Interview Problem: Word Ordering in a Different Alphabetical Order
  9. Daily Interview Question: Word Search
  10. Top K Frequent words

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />