Center of mass
Given a matrix M(m,n), where m is the number of vertices of the geometrical element and n is 2 or 3 (2D-plane figure or 3D-solid...
4年弱 前
解決済み
only input
Return the output without writing any code into the function.
4年弱 前
解決済み
frame of the matrix
Given the matrix M, return M without the external frame.
4年弱 前
解決済み
surrounded matrix
With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones:
A = [1 2 ...
4年弱 前
解決済み
Back to basics 22 - Rotate a matrix
Covering some basic topics I haven't seen elsewhere on Cody.
Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...
4年弱 前
解決済み
Bottles of beer
Given an input number representing the number of bottles of beer on the wall, output how many are left if you take one down and ...
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年弱 前
解決済み
Scoring for oriented dominoes
Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...
Find a Pythagorean triple
Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...
4年弱 前
解決済み
Numbers on 7-segment
This is a 7-segment:
_
|_|
|_|
It's a 3-by-3 char matrix.It has made by 3 characters: '_' , '|' and ' ' (space...