Solved

Words Count: A Cell Array Approach

Given an input character vector consisting of words, punctuation marks, white spaces, and possibly newline characters (\n), arra...

plus de 2 ans ago

Solved

How long is the longest prime diagonal?

Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

plus de 2 ans ago

Solved

Spot the outlier

All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

plus de 2 ans ago

Solved

Find a subset that divides the vector into equal halves

Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

plus de 2 ans ago

Solved

Invert a 3D rigid-body transformation

Given an SE(3) matrix representing a rigid-body motion, compute its inverse without using |inv()| or |pinv()| .

plus de 2 ans ago

Solved

Parsing Expressions - Binary Arithmetic Operators I

Parse and evaluate expressions like these: '1 + 2' '51 - 78' '42 * 9' The only operators are +, -, *. Both argu...

plus de 2 ans ago

Solved

Replicate elements in vectors

Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...

plus de 2 ans ago

Solved

Find the largest value in the 3D matrix

Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

plus de 2 ans ago

Solved

Bridge and Torch Problem - Minimum time

<https://en.wikipedia.org/wiki/Bridge_and_torch_problem Details of the problem ...> Input is crossing time list. (for exampl...

plus de 2 ans ago

Solved

Remove the positive integers.

Given array,x, remove all the positive numbers and display ouput as y. Example x=[1 -2 3 -4] , output is y=[-2 -4].

plus de 2 ans ago

Solved

Generate N equally spaced intervals between -L and L

Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

plus de 2 ans ago

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

plus de 2 ans ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

plus de 2 ans ago

Solved

Set the array elements whose value is 13 to 0

Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

plus de 2 ans ago

Solved

Return unique values without sorting

If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

plus de 2 ans ago

Solved

Specific Element Count

Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

plus de 2 ans ago

Solved

First non-zero element in each column

For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

plus de 2 ans ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

plus de 2 ans ago

Solved

Bit Reversal

Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

plus de 2 ans ago

Solved

Parse me a Lisp

*Description* In Lisp and its variants, function calls are done using parenthesis where the first item in the parenthesis is ...

plus de 2 ans ago

Solved

5th Time's a Charm

Write a function that will return the input value. However, your function must fail the first four times, only functioning prope...

plus de 2 ans ago

Solved

Acid and water

⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ Assume that there is a 100 liter tank. It is initially fi...

plus de 2 ans ago

Solved

Check if number exists in vector

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

plus de 2 ans ago

Solved

Replace NaNs with the number that appears to its left in the row.

Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

plus de 2 ans ago

Solved

Binary numbers

Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

plus de 2 ans ago

Solved

Counting Money

Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

plus de 2 ans ago

Solved

Length of the hypotenuse

Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

plus de 2 ans ago

Solved

Pangrams!

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

plus de 2 ans ago

Solved

Find the longest sequence of 1's in a binary sequence.

Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

plus de 2 ans ago

Solved

Missing five

Convert decimal numbers to a base-9 notation missing the digit *5* <<http://www.alfnie.com/software/missing5.jpg>> Too man...

plus de 2 ans ago