已解决


Cancel Middle
Write a function called cancel_middle that takes A, an n-by-m matrix, as an input where both n and m are odd numbers an...

4 years 前

已解决


Double Fibonacci
double_fibonacci takes two integers, each greater than one, as input arguments (it does not have to check the format of the inpu...

4 years 前

已解决


Nth Order Polynomial Regression
Inputs: -two vectors x and y (row or column) -order of polynomial, p Outputs: -vector of coefficients [b0 b...

4 years 前

已解决


Number of digits in an integer
Specifies how many digits in a given integer. Example: in=100 ==> out=3

4 years 前

已解决


Create a function that gives a matrix like the following
x=3 y= [1 -1 -1 0 1 -1 0 0 1]; -------------------------------- x=5 y= [ 1 -1 -...

4 years 前

已解决


Sequence
Let S be a sequence of numbers Let Find for some , where and .

4 years 前

已解决


Determine whether one vector is a subset of another
While bumbling through a pair of problems in the Number Theory group, I wrote code to determine whether a vector is a subset of ...

4 years 前

已解决


Find all prime factors of the input
Given an input x, find its all prime factors. Return the vector with all factors in ascending order. Efficiency is the key here...

4 years 前

已解决


Chain multiplication - 01
Say, you are given two matrices - A (shape= 3*4) and B(shape = 4*5). If you multiply these two matrices, the resultant matrix w...

4 years 前

已解决


Number of leaps in binary search
Binary search is one of the most popular searching algorithms (Binary Search Algorithm). It works only in a sorted array. It uti...

4 years 前

已解决


Cut the rod
A rod of length n can be cut in different sizes. Different price is associated with different length of cuts. length, len= [1,...

4 years 前

已解决


Sort Non-zeros
Consider 0s in a vector creates a break-point. sort all the sub-arrays created by those break points. For example, a = [3, 4, 1...

4 years 前

已解决


Find the number of primes leq than input
Given an integer n, determine the number of primes less than or equal to n.

4 years 前

已解决


Draw 'W'
For any given n, return a matrix of height n and width 4n-3 containing a W of ones. Example: n=2 ans= [1 0 1 0 1 0 1 0 1 0...

4 years 前

已解决


String Logic 17
Examples: 'DIG' --> 'GDI' 'IMPORTANT' --> 'TANTIMPOR' 'DEAL' --> 'EALD' 'LIMB' --> 'IMBL' 'MOSTLY' --> 'YMOSTL'

4 years 前

已解决


String Logic 16
Examples: 'DIG' --> 'DIG' 'KIMBALL' --> 'ALLKIMB' 'DEAL' --> 'EALD' 'LIMB' --> 'IMBL' 'MADE' --> 'ADEM'

4 years 前

已解决


Find Min and Max Differences in a Vector
Given an array of integers, return the absolute largest and smallest (non zero) difference between any two numbers in the array....

4 years 前

已解决


Use a timetable to analyze a train timetable (Part 1)
Oh no, you missed your train to Boston! Find the departure time of the next available train by analyzing the train timetable. Th...

4 years 前

已解决


First use of arrayfun() and anonymous function @(x)
Create an anonymous function using @(x) for a parabola equation for the given coefficients stored in s with s(1)x2 + s(2)x + s(...

4 years 前

已解决


Absolute Value of the Product of Complex Numbers
Find the absolute value (modulus) of the product of two complex numbers given by a + bi and c + di.

4 years 前

已解决


Find the nth composite number.
Everyone heard about the nth prime number. Let's try to find out the nth composite. For example , 1 is the first composite, 10 i...

4 years 前

已解决


Draw the symbol '+'
Draw '+' in an x-by-x matrix (where x is odd and x >3) Example: x = 5 y = [0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 ...

4 years 前

已解决


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 years 前

已解决


Sum of digits of powers of 2
Given n, first, calculate the number 2^n. Then, sum the digits that comprise that number. For example: Input: n = 7 2^n = ...

4 years 前

已解决


Square the input
Given a scalar or vector x, return the square of each element. Example x = [7 2] answer = [49 4]

4 years 前

已解决


Sum of Arithmetic Progression
Given the starting number, difference and the number of terms - find the sum of the arithmetic progression.

4 years 前

已解决


Find the slope of a line that passes through two vectors
Given two vectors p1 and p2, return the slope of a line that passes through p1 and p2. Examples: Input [p1,p2] = deal([0,1],[...

4 years 前

已解决


Add the number of horizontal and vertical movements to each matrix element
Given n, create a square matrix and with element (1,1) = 1, add 1 to each element for each horitizonal and vertical movement. E...

4 years 前

已解决


Check if a matrix Diagonal is equal to its secondary diagonal
Your function should return True if the secondary diagonal is equal to diagonal, and False otherwise. Eg: M = [1 2 1 ...

4 years 前

已解决


String Logic 15
Examples: 'CAT' --> 'XZG' 'DOG' --> 'WLT' 'ROSY' --> 'ILHB' 'MOSTLY' --> 'NLHGOB'

4 years 前

加载更多