Number of 1s in a binary string
Find the number of 1s in the given binary string.
Example. If the input string is '1100101', the output is 4. If the input stri...
5年弱 前
解決済み
Add more zeros
Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1).
For example:
'1010' -> '100100'
...
letter yes yes & letter no no
Split a string into two strings, wherein the first string has all alphabetic letters and the second string has all the remaining...
5年弱 前
解決済み
Convert String to Morse Code
Convert a given string to international <http://en.wikipedia.org/wiki/Morse_code Morse Code>
* Strings will only have [A-z], ...
5年弱 前
解決済み
Find matching string from a list of strings
Write a function that returns a string that is a unique match (if it exists) of the string |inStr| from a list of strings |strLi...
Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have
a = [1 2 2 2 1 ...
5年弱 前
解決済み
Decimal Comparison
*Background*
A utility of particular interest to Cody and other MATLAB ventures is comparing the equality of two numbers. In ...
5年弱 前
解決済み
Find Rotated Substring
Given a string s1, find if a rotated version of s1 is present in a second string s2.
For example, rotated version of some str...
5年弱 前
解決済み
Reverse the Words (not letters) of a String
*Description*
Change the words of a string such that the words appear in reverse order. You may assume that the string is a n...
5年弱 前
解決済み
Space Saver
Remove all characters that are below a space in ASCII value.
5年弱 前
解決済み
Find matching parenthesis
One of the most indispensable things about a great text editor for programming is the ability to quickly jump between matching p...
5年弱 前
解決済み
Piecewise linear interpolation
Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...
5年弱 前
解決済み
Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...
5年弱 前
解決済み
Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle.
<<https://i.imgu...
5年弱 前
解決済み
Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because
6 = 1 + 2 + 3
which can be displa...
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...
5年弱 前
解決済み
Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the numbers. Otherwise return false.
Example...
5年弱 前
解決済み
Maximum value in a matrix
Find the maximum value in the given matrix.
For example, if
A = [1 2 3; 4 7 8; 0 9 1];
then the answer is 9.