Community Profile

photo

Ngo Tien Sang


Last seen: 2 dagen ago
125 total contributions since 2021

Ngo Tien Sang's Badges

  • Introduction to MATLAB Master
  • CUP Challenge Master
  • Community Group Solver
  • Draw Letters
  • First Answer
  • Solver

View details...

Contributions in
View by

Solved


Mirror Image matrix across anti-diagonal
Given an input number x, create a mirror image matrix 'Y' across the anti-diagonal. For example, if x=3, Y = [1 2 3; ...

2 dagen ago

Solved


Symmetric matrix
You must create a n-by-n *symmetric* matrix such that A(row,col) = row/col for col >= row. Example if n =3 : output is : ...

2 dagen ago

Solved


"mirror" matrix
Create n x 2n "mirror" matrix of this type: Examples For n = 2 m = [ 1 2 2 1 1 2 2 1 ] For n = 3 m = ...

10 dagen ago

Solved


Special matrix
Make a square matrix with this shape. For n=4 M = 1 1 0 0 1 0 1 0 0 1 0 ...

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

11 dagen ago

Solved


Permute diagonal and antidiagonal
Permute diagonal and antidiagonal For example [1 2 3;4 5 6;7 8 9] -> [3 2 1;4 5 6;9 8 7] WITHOUT diag function (and variable n...

12 dagen ago

Solved


Set some matrix elements to zero
First get the maximum of each *row*, and afterwards set all the other elements to zero. For example, this matrix: 1 2 3 ...

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

24 dagen ago

Solved


Make an awesome ramp for a tiny motorcycle stuntman
Okay, given a vector, say v=[1 3 6 9 11], turn it into a matrix 'ramp' like so: m=[1 3 6 9 11; 3 6 9 11 0; 6 9 ...

24 dagen ago

Solved


Rotate input square matrix 90 degrees CCW without rot90
Rotate input matrix (which will be square) 90 degrees counter-clockwise without using rot90,flipud,fliplr, or flipdim (or eval)....

24 dagen ago

Solved


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

27 dagen ago

Solved


Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

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

27 dagen ago

Solved


Project Euler: Problem 1, Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

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

27 dagen ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

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

ongeveer een maand ago

Solved


Create a Multiplication table matrix...
Create a product table in this format: P = [ 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 1...

ongeveer een maand ago

Solved


Volume Pillar
Calculate the volume of a pillar with radius l and heigth ar.

ongeveer een maand ago

Solved


Convert radians to degrees
Given input in radians, output to degrees

ongeveer een maand ago

Solved


Perimeter of a semicircle
Given the diameter d, find the perimeter of a semicircle

ongeveer een maand ago

Solved


radius of a spherical planet
You just measured its surface area, that is the input.

ongeveer een maand ago

Solved


Calculate area of sector
A=function(r,seta) r is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2...

ongeveer een maand ago

Solved


Rotate Matrix @180 degree
Rotate Matrix @180 degree Example A=[8 1 6; 3 5 7; 4 9 2], then answer would be [2 9 4;...

ongeveer een maand ago

Solved


Converts numbers into characters
Converts numbers into characters

ongeveer een maand ago

Solved


Find the max element of the array
Find the max element of the array

ongeveer een maand ago

Solved


Square root
Given x (a matrix), give back another matrix, where all the elements are the square roots of x's elements.

ongeveer een maand ago

Solved


Calculate the average value of the elements in the array
Calculate the average value of the elements in the array

ongeveer een maand ago

Solved


to the 2 all elements
to the 2 all elements

ongeveer een maand ago

Solved


the average value of the elements
Calculate the average value of the elements in the array

ongeveer een maand ago

Load more