Bubble sort
Write your own bubble sort function ( <https://en.wikipedia.org/wiki/Bubble_sort>) to sort all elements in x in ascending order....
10年弱 前
解決済み
Avengers Assemble!
Given matrix with so many zeroes, trim those zeroes and output a matrix joining all nnz elements
Example:
input = [0 0 0 0 0...
10年弱 前
解決済み
Weighted Convolution
Given two input vectors x = [x_1, x_2, ..., x_K] and y = [y_1, y_2, ..., y_K] of equal length, compute the weighted convolution ...
cross in array
Make a cross from "1" in odd size array. Other value from array should be equal to "0";
As input you get length of side of arra...
10年弱 前
解決済み
Probabilities - Balls and urns - 01
The urn contains B blue balls and R red balls. Each trial consists of drawing one random ball from the urn and observing its col...
10年弱 前
解決済み
Strangest ways to get 0
Propose your non-trivial way to get 0. Look mine's, and try to do your best!
10年弱 前
解決済み
Add the even numbers
Add only the even numbers of x
example:
x = [1 2 3 4 5]
the positive numbers are: 2 4, so their sum is 6
10年弱 前
解決済み
Sum of digits of powers of 2
Given n, first, calculate the number 2^n. Then, sum the digits that comprise that number. For example:
Input: n = 7
2^n = ...
10年弱 前
解決済み
Euclidean inter-point distance matrix
The Euclidean distance between two points in a p-dimensional space is a really common thing to compute in the field of computati...
10年弱 前
解決済み
What's size of TV?
Many people buy TV. Usually they ask about diagonal. But also important are width and height. Let's assume that all TV have rati...