Task 1: "Pack a Spiral Submitted by: Stuart Little You are given an array @A of items (integers say, but they can be anything). Your task is to pack that array into an MxN matrix spirally counterclockwise, as tightly as possible. 'Tightly' means the absolute value |M-N| of the difference has to be as small as possible. Example 1: Input: @A = (1,2,3,4) Output: 4 3 1 2 Since the given array is already a 1x4 matrix on its own, but that's not as tight as possible. Instead, you'd spiral it counterclockwise into 4 3 1 2 Example 2: Input: @A = (1..6) Output: 6 5 4 1 2 3 or 5 4 6 3 1 2 Either will do as an answer, because they're equally tight. Example 3: Input: @A = (1..12) Output: 9 8 7 6 10 11 12 5 1 2 3 4 or 8 7 6 9 12 5 10 11 4 1 2 3 " My notes: ok, interesting question. First, need to find "tightest" MxN where abs(M-N) is minimum, easy. Second, need to build MxN array via a "counterclockwise spiral starting at bottom corner". Not trivial, but should be relatively easy. Hmmm.. actually, I can't see a particularly quick and easy way, I'm sure I'm missing something. Task 2: "Origin-containing Triangle Submitted by: Stuart Little You are given three points in the plane, as a list of six co-ordinates: A=(x1,y1), B=(x2,y2) and C=(x3,y3). Write a script to find out if the triangle formed by the given three co-ordinates contain origin (0,0). Print 1 if found otherwise 0. Example 1: Input: A=(0,1), B=(1,0) and C=(2,2) Output: 0 because that triangle does not contain (0,0). Example 2: Input: A=(1,1), B=(-1,1) and C=(0,-3) Output: 1 because that triangle contains (0,0) in its interior. Example 3: Input: A=(0,1), B=(2,0) and C=(-6,0) Output: 1 because (0,0) is on the edge connecting B and C. " My notes: oh, God. Geometry. I hate geometry. Intuitively I've no idea how to do this, so need to Google for solutions. Many different ways, vectors, cross products, etc. Easiest to understand is from www.geeksforgeeks.org/check-whether-a-given-point-lies-inside-a-triangle-or-not/ and it seems to work (even it compares areas with "=="). Hmm, this seems easier than Task 1!