Community Profile

Thinh Hoang

Last seen: Today
107 2021 年以降の合計貢献数

Thinh Hoang's バッジ

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

4日 前

Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

5日 前

Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

5日 前

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

11日 前

Remove the vowels
Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

11日 前

Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

11日 前

Read a column of numbers and interpolate missing data
Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

11日 前

The Goldbach Conjecture, Part 2
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

11日 前

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

12日 前

Choose the best fitting dominoes
You will be given a cell array of nx2 matrices. Choose one row from each matrix. These are the ordered pairs that will be plac...

Find best placement for ordered dominoes (harder)
Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

Stuff the Board
You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

Rotate and display numbered tile
Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west. If th...

Find perfect placement of non-rotating dominoes (easier)
Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

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

Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Examp...

Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

Remove all the consonants
Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

Pangrams!
A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

Draw 'H'
Draw a x-by-x matrix 'H' using 1 and 0. (x is odd and bigger than 2) Example: x=5 ans= [1 0 0 0 1 1 0 0 0 1 ...

Draw 'C'.
Given x as input, generate a x-by-x matrix 'C' using 0 and 1. example: x=4 ans= [0 1 1 1 1 0 0 0 ...

Draw a 'X'!
Given n as input Draw a 'X' in a n-by-n matrix. example: n=3 y=[1 0 1 0 1 0 1 0 1] n=4 y=[1 0 0...

Draw 'O' !
Given n as input, generate a n-by-n matrix 'O' using 0 and 1 . example: n=4 ans= [1 1 1 1 1 0 0 1 ...

Draw a 'Z'.
Given _n_ as input, generate a n-by-n matrix like 'Z' by _0_ and _1_ . Example: n=5 ans= [1 1 1 1 1 0 0 0 1 ...

Draw 'I'
Given n as input, draw a n-by-n matrix 'I' using 0 and 1. example: n=3 ans= [0 1 0 0 1 0 0 1 0] n=...

Find max
Find the maximum value of a given vector or matrix.

Find the sides of an isosceles triangle when given its area and height from its base to apex
Find the sides of an isosceles triangle when given its area and the height from its base to apex. For example, with A=12 and ...

Height of a right-angled triangle
Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...