Task 1: "Pythagorean Triples You are given a positive integer $N. Write a script to print all Pythagorean Triples containing $N as a member. Print -1 if it can't be a member of any. i Triples with the same set of elements are considered the same, i.e. if your script has already printed (3, 4, 5), (4, 3, 5) should not be printed. The famous Pythagorean theorem states that in a right angle triangle, the length of the two shorter sides and the length of the longest side are related by a2+b2 = c2. A Pythagorean triple refers to the triple of three integers whose lengths can compose a right-angled triangle. Example Input: $N = 5 Output: (3, 4, 5) (5, 12, 13) Input: $N = 13 Output: (5, 12, 13) (13, 84, 85) Input: $N = 1 Output: -1 " My notes: the tricky part here is knowing how to generate all Pythagorean triples that MIGHT contain $N, i.e. when to stop generating triples.. Task 2: "Binary Tree Diameter You are given binary tree as below: 1 / \ 2 5 / \ / \ 3 4 6 7 / \ 8 10 / 9 Write a script to find the diameter of the given binary tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. It doesn't have to pass through the root. For the above given binary tree, possible diameters (6) are: 3, 2, 1, 5, 7, 8, 9 or 4, 2, 1, 5, 7, 8, 9 UPDATE (2021-08-10 17:00:00 BST): Jorg Sommrey corrected the example. The length of a path is the number of its edges, not the number of the vertices it connects. So the diameter should be 6, not 7. " My notes: Looks quite tricky. We can use generate and test - if we can generate all paths, then we could do a "max" test. Also, how to represent the binary tree? let's hard-code it for now.