解決済み


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

解決済み


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

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

解決済み


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

約4年 前

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

約4年 前

解決済み


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

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

解決済み


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

約4年 前

解決済み


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

約4年 前

解決済み


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

解決済み


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

解決済み


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

解決済み


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

約4年 前

さらに読み込む