# Sushma Swaraj

### MathWorks

Last seen: ongeveer een jaar ago Active since 2023

Followers: 0   Following: 0

I am an Engineering Development Group Intern at MathWorks.

All

View badges

#### Feeds

View by

Solved

Sum of first n terms of a harmonic progression
Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

ongeveer een jaar ago

Solved

Angle between two vectors
You have two vectors , determine the angle between these two vectors For example: u = [0 0 1]; v = [1 0 0]; The a...

ongeveer een jaar ago

Solved

Find the largest number
Find the largest number |x| among 4 numbers given as variables |a|, |b|, |c|, and |d|. Example: Input: a = 4; b = 7; c ...

ongeveer een jaar ago

Solved

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

ongeveer een jaar ago

Solved

Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

ongeveer een jaar ago

Solved

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

ongeveer een jaar ago

Solved

Calculate the Levenshtein distance between two strings
This problem description is lifted from http://en.wikipedia.org/wiki/Levenshtein_distance. The Levenshtein distance between two...

ongeveer een jaar ago

Solved

Transpose of matrix
Transpose of matrix as per test cases

ongeveer een jaar ago

Solved

Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

ongeveer een jaar ago

Solved

Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

ongeveer een jaar ago

Solved

Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

ongeveer een jaar ago

Solved

Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

ongeveer een jaar ago

Solved

Return area of square
Side of square=input=a Area=output=b

ongeveer een jaar ago

Solved

Find common elements in matrix rows
Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

ongeveer een jaar ago

Solved

Test for balanced parentheses
Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

ongeveer een jaar ago

Solved

Duplicates
Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...

ongeveer een jaar ago

Solved

Counting Sequence
Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

ongeveer een jaar ago

Solved

Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displayed ...

ongeveer een jaar ago

Solved

Add two numbers
Given a and b, return the sum a+b in c.

ongeveer een jaar ago

Answered
How to crop 1 inch
Hi, We use the 'imcrop' function to crop an image. % Read the image image = imread('your_image.jpg'); % Replace 'your_image.jp...

ongeveer een jaar ago | 0

Solved

Fibonacci-Sum of Squares
Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

ongeveer een jaar ago

Solved

Target sorting
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

ongeveer een jaar ago

Solved

Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Input...

ongeveer een jaar ago

Solved

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

ongeveer een jaar ago

Solved

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

ongeveer een jaar ago

Solved

Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

ongeveer een jaar ago

Solved

Find the peak 3n+1 sequence value
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

ongeveer een jaar ago

Solved

Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

ongeveer een jaar ago

Solved

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

ongeveer een jaar ago

Solved

Return a list sorted by number of occurrences
Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x. Ties are resolved by a ...

ongeveer een jaar ago