Community Profile

# Jake McIvor

### University of British Columbia

44 2012 年以降の合計貢献数

#### Jake McIvor's バッジ

The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

9年弱 前

Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

9年弱 前

Is my wife right?
Regardless of input, output the string 'yes'.

9年弱 前

Function Iterator
Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

9年弱 前

Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

9年弱 前

Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

9年弱 前

Encode Roman Numerals
Create a function taking a non-negative integer as its parameter and returning a string containing the Roman Numeral representat...

9年弱 前

It dseon't mettar waht oedrr the lrettes in a wrod are.
An internet meme from 2003 (read more <http://www.snopes.com/language/apocryph/cambridge.asp here>) asserted that readers are re...

9年弱 前

Remove all the words that end with "ain"
Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

9年弱 前

QWERTY coordinates
Given a lowercase letter or a digit as input, return the row where that letter appears on a <http://en.wikipedia.org/wiki/Keyboa...

9年弱 前

Tic Tac Toe FTW
Given a tic tac toe board: * 1 represents X * 0 represents empty. * -1 represents O It is X's move. If there is an imme...

9年弱 前

Target sorting
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

9年弱 前

The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

9年弱 前

Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

9年弱 前

Pangrams!
A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

9年弱 前

Find state names that end with the letter A
Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

9年弱 前

Given a list of US states, remove all the states that start with the letter N. If s1 = 'Alabama Montana Nebraska Vermont Ne...

9年弱 前

Find the two-word state names
Given a list of states, remove all the states that have two-word names. If s1 = 'Alabama Montana North Carolina Vermont N...

9年弱 前

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

9年弱 前

Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

9年弱 前

Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

9年弱 前

Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

9年弱 前

Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

9年弱 前

Elapsed Time
Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

9年弱 前

Remove all the consonants
Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

9年弱 前

Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

9年弱 前

Which values occur exactly three times?
Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

9年弱 前

Find the numeric mean of the prime numbers in a matrix.
There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

9年弱 前

Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

9年弱 前

Remove the vowels
Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

9年弱 前