242 total contributions since 2017

Graduated from Multimedia Telecommunication, dove into Embedded Systems in Aerospace Engineering.

Currently worrying about where to go next.

Solved

Number of digits in an integer

Specifies how many digits in a given integer. Example: in=100 ==> out=3

3일 ago

Solved

Converting binary to decimals

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

3일 ago

Solved

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

3일 ago

Solved

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

3일 ago

Solved

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

3일 ago

Solved

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

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

3일 ago

Solved

How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

3일 ago

Solved

Find hen's weight.

If hen weights x kilos on two legs, how much does it weights on one leg? Output the result.

4일 ago

Solved

Reindex a vector

You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

4일 ago

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

4일 ago

Solved

Pascal's Triangle

Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

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

4일 ago

Solved

Solve the Sudoku Row

*Description* A simple yet tedious task occurs near the end of most Sudoku-solving algorithms, computerized or manual. The ta...

4일 ago

Solved

Insert zeros into vector

Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

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

4일 ago

Solved

Pernicious Anniversary Problem

Since Cody is 5 years old, it's pernicious. A <http://rosettacode.org/wiki/Pernicious_numbers Pernicious number> is an integer w...

4일 ago

Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

4일 ago

Solved

Count photos

Given n people, everyone must have pictures taken with everyone, each photo includes only two persons, please count the total nu...

4일 ago

Solved

Replace Vector Elements

Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

4일 ago

Solved

Make a 1 hot vector

Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

4일 ago

Solved

Back to basics 15 - classes

Covering some basic topics I haven't seen elsewhere on Cody. Return the class of the input variable.

4일 ago

Solved

Reverse the elements of an array

Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

4일 ago

Solved

Rotate a Matrix by 90 degrees

Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

4일 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] ...

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

4일 ago

Solved

Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

6일 ago