Risolto

Length of a short side

Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

9 mesi fa

Risolto

Matrix Transposition

Given a matrix and an index, perform matrix transposition as follows - Replace non-corner value of ith ring from outside, with...

9 mesi fa

Risolto

Multiples of a Number in a Given Range

Given an integer factor _f_ and a range defined by _xlow_ and _xhigh_ inclusive, return a vector of the multiples of _f_ that fa...

9 mesi fa

Risolto

Smith numbers

Return true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at <http://en.wikipedi...

9 mesi fa

Risolto

There are 10 types of people in the world

Those who know binary, and those who don't. The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year...

9 mesi fa

Risolto

Converting binary to decimals

Convert binary to decimals. Example: 010111 = 23. 110000 = 48.

9 mesi fa

Risolto

Binary code (array)

Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

9 mesi fa

Risolto

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

9 mesi fa

Risolto

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

9 mesi fa

Risolto

Given an unsigned integer x, find the largest y by rearranging the bits in x

Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

9 mesi fa

Risolto

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

9 mesi fa

Risolto

Find out sum and carry of Binary adder

Find out sum and carry of a binary adder if previous carry is given with two bits (x and y) for addition. Examples Previo...

9 mesi fa

Risolto

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

9 mesi fa

Risolto

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

9 mesi fa

Risolto

Determine whether the input is an anagram number

In Cody Problem 44293, Mehmet OZC asks us to spell numbers as words. For example, 67 would be “sixty-seven” and 76 would be “sev...

9 mesi fa

Risolto

String Logic 11

Examples: 'SUNDAY' --> 6 'MONDAY' --> 6 'TUESDAY' --> 7 'WEDNESDAY' --> 9 'THURSDAY' --> 8 'FRIDAY' --> 5 'SATURDAY' --...

9 mesi fa

Risolto

Backgammon #4 - Dice Probabilities

Previous problems in this series have looked at how a backgammon board might be represented, and board positions manipulated and...

9 mesi fa

Risolto

Handle to an array of functions

Given a cell array of functions that operate on scalars, it is required to return a function handle to process a vector of value...

9 mesi fa

Risolto

Apply a function array to an array of numbers

It is required to apply a cell array of functions to a numerical array, where the functions accept only scalar inputs. Exampl...

9 mesi fa

Risolto

Function composition

Write a function that accepts two function handles f and g and returns the composition h. That is, h = (f o g)(x) = f(g(x)) ...

9 mesi fa

Risolto

Natural numbers in string form

Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be. Ex...

9 mesi fa

Risolto

Fix the last element of a cell array

Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

9 mesi fa

Risolto

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

9 mesi fa

Risolto

Cell Counting: How Many Draws?

You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

9 mesi fa

Risolto

Remove element(s) from cell array

You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

9 mesi fa

Risolto

Convert a Cell Array into an Array

Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

9 mesi fa