Blog

POW Answer – Circle, Square, Circle

Last week’s problem involved using your geometry/trigonometry skills to find areas of shapes. We start off with a large (black) circle which has a (black) square inscribed in it which in turn has a (red) circle inscribed in it: Let’s start off with the equation for the area of a Read more…

By Chris West, ago
Blog

POW – Circle, Square, Circle

Recently a friend asked why I haven’t put up any new POWs (Problems of the Week). Part of the reason is because I got lazy but the other part is because the show Numb3rs is what inspired me before and I haven’t been watching any reruns lately 😛. Yesterday I Read more…

By Chris West, ago
Blog

POW – Sequential Triad 24

Many people are familiar with the math game 24, but not many know about the sequential triad version. You must make each of the following sequences true by only inserting operators and without changing the order of the numbers: 0 1 2 = 24 1 2 3 = 24 2 Read more…

By Chris West, ago
Blog

POW – JavaScript Self Inequality

Assuming a normal JavaScript engine, what could you possibly pass into the following mystery() function that would not thrown an error? function mystery(a) { if (a === a) { throw new Error('The first argument has self equality.'); } } As is normal, this answer will be shown a week from Read more…

By Chris West, ago
Blog

POW – Multiple Choice Question?

This Problem of the Week will make you question whether or not multiple choice questions really are easier. Here is the question: Assuming the answer can be selected from the following list, if you were to choose one of the following at random, what is the chance that you would Read more…

By Chris West, ago
Blog

POW Answer – Explain That SQL #1

To answer last week’s POW, the purpose of the SQL was to generate a random string of letters and numbers. I actually wrote two different JavaScript function that can produce the same results. The following is the slightly more straight-forward solution: function randomChars(len) { for(var n, s = ""; --len;) Read more…

By Chris West, ago
Blog

POW – Explain That SQL #1

Someone asked me to quickly write them some code in any language that would accomplish a certain task. The following, which is in PostgreSQL, is the second solution that I came up with after doing the first one in my favorite language, JavaScript: SELECT ARRAY_TO_STRING(ARRAY( SELECT CHR(num + CASE WHEN Read more…

By Chris West, ago
Blog

POW Answer – Unnamed Function #2

This answers the Problem of the Week from May 8, 2012. The identity of this well-known computer science function is the binary search. The following is the same code from before with the variables more properly named: var binarySearch = (function(internal) { function search(array, item, temp1, temp2) { array = Read more…

By Chris West, ago