De-dupe
Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if
a =...
3年以上 前
解決済み
The Piggy Bank Problem
Given a cylindrical piggy bank with radius g and height y, return the bank's volume. [ g is first input argument.]
Bonus though...
4年以上 前
解決済み
Find the two-word state names
Given a list of states, remove all the states that have two-word names.
If
s1 = 'Alabama Montana North Carolina Vermont N...
約5年 前
解決済み
Alphabetize by last name
Given a list of names in a cell array, sort the list by the last name. So if
list = {'Barney Google','Snuffy Smith','Dagwood ...
約5年 前
解決済み
Tic Tac Toe FTW
Given a tic tac toe board:
* 1 represents X
* 0 represents empty.
* -1 represents O
It is X's move. If there is an imme...
5年以上 前
解決済み
Summing Digits within Text
Given a string with text and digits, add all the numbers together.
Examples:
Input str = '4 and 20 blackbirds baked in a...
5年以上 前
解決済み
Counting Sequence
Given a vector x, find the "counting sequence" y.
A counting sequence is formed by "counting" the entries in a given sequence...
Find the two most distant points
Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...
5年以上 前
解決済み
Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...
5年以上 前
解決済み
Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...
5年以上 前
解決済み
Trimming Spaces
Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32).
Input a = ' singular value deco...
5年以上 前
解決済み
Subset Sum
Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. I...
5年以上 前
解決済み
Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....
5年以上 前
解決済み
Reverse Run-Length Encoder
Given a "counting sequence" vector x, construct the original sequence y.
A counting sequence is formed by "counting" the entrie...
Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...
5年以上 前
解決済み
Function Iterator
Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...