Community Profile

# Nicolas BERNARD

##### Last seen: 20 giorni ago
126 total contributions since 2016

View details...

Contributions in
View by

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

20 giorni ago

Solved

Arrange Vector in descending order
If x=[0,3,4,2,1] then y=[4,3,2,1,0]

20 giorni ago

Solved

Calculate the Hamming distance between two strings
Inspired by a similar Cody problem found <http://www.mathworks.com/matlabcentral/cody/problems/93-calculate-the-levenshtein-dist...

circa 3 anni ago

Solved

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

circa 3 anni ago

Solved

Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1). For example: '1010' -> '100100' ...

circa 3 anni ago

Solved

Reverse the Words (not letters) of a String
*Description* Change the words of a string such that the words appear in reverse order. You may assume that the string is a n...

circa 3 anni ago

Solved

Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

circa 3 anni ago

Solved

Create a Standard Size Vector
Given an input x, create a row vector y from 1 to x with 5 elements.

circa 3 anni ago

Solved

means
Calculate the arithmetic, the geometric and the harmonic mean of a given vector (with positive elements) and return them in a ve...

circa 3 anni ago

Solved

Matrix FUN
Given a Matrix M, find out the number of elements of matrix that are divisible by 3. M = [1 2 3;4 5 6;7 8 9]; ou...

circa 3 anni ago

Solved

Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

circa 3 anni ago

Solved

Return a list sorted by number of consecutive occurrences
Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

circa 3 anni ago

Solved

Sum of series V
What is the sum of the following sequence: Σk(k+1) for k=1...n for different n?

circa 3 anni ago

Solved

Sum of series IV
What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

circa 3 anni ago

Solved

Sum of series III
What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

circa 3 anni ago

Solved

Sum of series II
What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

circa 3 anni ago

Solved

Sum of series I
What is the sum of the following sequence: Σ(2k-1) for k=1...n for different n?

circa 3 anni ago

Solved

Create a matrix X, where each column is a shifted copy of the vector v
Example : in->v = (1:5)'; 1 2 3 4 5 out-> [1 5 4 3 2;2 1 5 4 3;3 2 1 5 4;4 3 2 1 5;5 4 3 ...

circa 3 anni ago

Solved

Remove the air bubbles
Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

circa 3 anni ago

Solved

Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

circa 3 anni ago

Solved

Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

circa 3 anni ago

Solved

Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

circa 3 anni ago

Solved

Getting the absolute index from a matrix
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get the <http://www.ma...

circa 3 anni ago

Solved

Convert a vector into a number
This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

circa 3 anni ago

Solved

Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

circa 3 anni ago

Solved

Getting the row and column location from a matrix
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get <http://www.mathwo...

circa 3 anni ago

Solved

Create a Matrix of Zeros
Given an input x, create a square matrix y of zeros with x rows and x columns.

circa 3 anni ago

Solved

Factorial Numbers
Factorial is multiplication of integers. So factorial of 6 is 720 = 1 * 2 * 3 * 4* 5 *6 Thus 6 factorial = factorial(720)....

circa 3 anni ago

Solved

Unit Matrix
Given n, you should return an n-by-n unit matrix. Example: If input is n=2 then A = [ 1 0 0 1 ] If input ...

circa 3 anni ago

Solved

Min of a Matrix
Return the minimum value in the given matrix.

circa 3 anni ago