Solved


row-th maximum row elements
Input a is a square matrix of size n*n. Output vector v is of size 1*n. The ith element of output v is the ith largest element o...

10 years ago

Solved


Should Mr McNugget even get out of bed today?
As we learned in <http://www.mathworks.com/matlabcentral/cody/problems/42888-frobenius-mcnugget-factorization an earlier problem...

10 years ago

Solved


Solving Quadratic Equations (Version 2)
Before attempting this problem, solve version 1: <https://www.mathworks.com/matlabcentral/cody/problems/2510-solving-quadratic-...

10 years ago

Solved


Remove the air bubbles
Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

10 years ago

Solved


Cellular Automaton | Rule X
Cellular Automata (CA) provide a convenient way to represent many kinds of systems in which the values of cells (either 0 or 1) ...

10 years ago

Solved


Find a subset that divides the vector into equal halves
Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

10 years ago

Solved


Spot the outlier
All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

10 years ago

Solved


Find the coefficient of a number in scientifc notation
Given a non-negative real number N, find the coefficient C and the exponent E of its scientific notation (N = C 10^E). Note that...

10 years ago

Solved


테스트
벡터 x가 주어져 있으면 전체 벡터의 총합의 반을 만들어 주는 원소들 (y)을 출력하는 함수 subsub 을 작성하라 예) 입력 x = [1 2 3 4 5 6 7] 출력 y = [1 6 7] 이유 : ...

10 years ago

Solved


테스트
어떤 수 (10진수)가 입력 (x)으로 들어오면 이 수를 이진수로 변환했을때 1의 갯수를 출력하는 함수 your_fcn_name 를 작성하라. 예) x=215 이면 이를 이진수로 변환하면 11010111 이므로 ...

10 years ago

Solved


테스트
입력으로 a, b, c를 주면 a*x^2 + b*x + c = 0. 의 해 (x)를 출력해주는 함수 solution 을 작성하라. 예) a=1, b=2, c=1 이면 x=-1

10 years ago

Solved


테스트
(x,y) 점들의 집합 (pts)이 주어져 있을때 같은 선위에 있지 않은 한점을 찾아서 몇번째 있는지 그 행수를 출력 (outlier) 하는 함수 spot_the_outlier 를 작성하라. 예: 입력, 총...

10 years ago

Solved


테스트 문제
다음과 같은 일을 수행하는 사용자 정의 함수 switchrow 를 짜라. y = switchrow(x, a, b) 입력으로 행렬 x을 받으면 x의 a행과 b행을 바꿔서 출력하는 switchrow 사용자 정의 함수를 짜라...

10 years ago

Solved


테스트
입력으로 어떤 수 (n) 이 주어져 있다면 그 수의 약수의 갯수 (y)를 출력하는 함수 your_fcn_name 을 작성하라 예) n=14 이면 약수가 1,2,7,14 이므로 y=4 n=68 이면 약수가 1...

10 years ago

Solved


테스트
입력으로 벡터 x와 정수 n이 주어진 다면 벡터 x에서 n번째로 큰 수 (y)를 출력하는 함수 n_max(x, n) 를 작성하라. 만일 그런 수가 없다면 NaN (not a number)를 출력하면 된다. 예...

10 years ago

Solved


테스트
다음과 같은 벡터를 1,2,2,3,3,3,4,4,4,4 만드는 사용자 정의 함수 your_fcn_name 을 작성하시오. 이 벡터는 그 숫자가 그 갯수 만큼 있다. 예) 만일 입력 n=3이면 3까지...

10 years ago

Solved


테스트
만일 어떤 벡터 v가 0부터 0까지의 값들만 원소로 갖는다고 할때 [3 4 2 9] ---> 3429 [1 3 5] ---> 135 와 같이 벡터를 수로 변환하는 함수 digits2Number 를 ...

10 years ago

Solved


Rotate Matrix @180 degree
Rotate Matrix @180 degree Example A=[8 1 6; 3 5 7; 4 9 2], then answer would be [2 9 4;...

10 years ago

Solved


Assignment Problem
Given a matrix where row i corresponds to person i, and column j corresponds to task j and cell (i,j) corresponds to the time ta...

10 years ago

Solved


Multiply by 3
There are many ways to obtain 3 times a number. You could multiply by 3, add the number 3 times, multiply by 6 and then subtract...

10 years ago

Solved


Find the sum of n squares
What is the sum of the squares of the first n integers?

10 years ago

Solved


Identify the sequence
Given a row vector, x, return 1 if it is an arithmetic series, or 2 if it is a geometric series. If it is neither, return 0. ...

10 years ago

Solved


Replace values out of an interval with the lower or upper values
For a vector or matrix X and an interval [n1,n2], the function replace every element of x inferior to n1 by n1, and every elemen...

10 years ago

Solved


Kurchan 5x5 - Optimal Score
Related to Problems 1646 and 2650, but bigger. Technically, all you need to do for this Cody problem is input a 5x5 matrix conta...

10 years ago

Solved


Values in Array
How many values are in the array

10 years ago

Solved


Kurchan 4x4 - Optimal score
Related to Problem 1646, but bigger. Technically, all you need to do for this Cody problem is input a 4x4 matrix containing the...

10 years ago

Solved


Kurchan 3x3 - Optimal Score
Find an optimal 3x3 Kurchan square, score of 198. A 3x3 Kurchan square has values 1:9.The products of each row, column, diag...

10 years ago

Solved


Kurchan Square - Evaluation Function
Evaluate a Kurchan square. An NxN square with values 1:N^2. Given a square matrix determine the products of each row, column,...

10 years ago

Solved


Block average
Given a matrix, calculate the block average of each disjoint sub-matrix of the same size. Assume that the size of the matrix alo...

10 years ago

Solved


Block average ignoring NaN values
Given a matrix, calculate the block average of each disjoint sub-matrix while ignoring *NaN* values. Assume that the size of the...

10 years ago

Load more