union without repitition
Let
a = [9 9 9 9 9 9 8 8 8 8 7 7 7 6 6 6 5 5 4 2 1]
b = [1 1 1 3 3 3 3 3 4 4 4 4 4 10 10 10]
Output should be
[9 8...
5 years ago
Solved
Alternately upper-lower case
Modify the string to alternate between upper and lower case. For example,
s='achyuta'
output='AcHyUtA'
5 years ago
Solved
Finding sum of even numbers in a vector.
Find the sum of all the even numbers present in the input vector x.
Examples:
Input x = [1 2 3 4]
Output y is 6
Input...
Sum the squares of numbers from 1 to n
For a given value of n return the sum of square of numbers from 1 to n.
Example
For n = 2
then sum of squares = 5 (1^2 + ...
5 years ago
Solved
What percentage?
Calculate the output c as the percentage of a on b for given a and b.
5 years ago
Solved
Sum of the Matrix Elements
Add up all the elements in a NxM matrix where N signifies the number of the rows and M signifies the number of the columns.
E...