Community Profile

Contact

Top 5% contributor

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

Solve this!

1 year ago

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

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

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...

You are given two line segments. Do they cross? Consider one segment as (x1,y1) to (x2,y2), the other segment as (x3,y3) to (...

Find an optimal 3x3 Kurchan square, score of 198. A 3x3 Kurchan square has values 1:9.The products of each row, column, diag...

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...

2 years ago

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...

Given a string, you must sort the characters by occurrence (from lowest to highest). This step is necessary to generate a Huf...

Regardless of input, output the string 'yes'.

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

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

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...

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...

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

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

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

Given the input n, return true if n is odd or false if n is even.

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...