exercism / exercism/problem-specifications

pythagorean-triplet: new tests require non-trivial solution

オープン
#1,347 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Ruby
スター
358
フォーク
563
平均マージ
18時間 41分
マージ済み PR(30日)
2

説明

I recently rewrote the Python version of this exercise based on [canonical data 1.0.0](https://github.com/exercism/problem-specifications/blob/master/exercises/pythagorean-triplet/canonical-data.json).

I wanted to update that the trivial solution for finding triplets in a range by brute force takes a very long time on the latest tests (for example [this](https://github.com/ThomasZumsteg/exercism-python/blob/master/pythagorean-triplet/pythagorean_triplet.py)). Almost all solutions I saw used this method and will not finish in reasonable time (if at all). I think it would be difficult for people to find an efficient solution by themselves. Perhaps a hint should be given?

The previous `example.py` would not handle these tests as well. The new [`example.py` ](https://github.com/exercism/python/blob/master/exercises/pythagorean-triplet/example.py) solves the tests quickly. It generates triplets in range efficiently by building triplets from multiples of primitive triplets.

Overall I think the new tests make the exercise more interesting. However, I think it would be difficult for people to come up with an efficient enough solution to pass them in reasonable time. I would be happy to hear what others think.

(related to #1211 )

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。