Community Profile

photo

Heyi Ding


Last seen: 2 månader ago Active since 2022

Statistics

  • Introduction to MATLAB Master
  • Community Group Solver
  • Solver

View badges

Content Feed

View by

Solved


Bit Reversal
Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

3 månader ago

Solved


Matlab Basics II - Count rows in a matrix
Write a function that returns that number of rows in a vector or matrix x example: x = [1; 2; 3] output = 3

3 månader ago

Solved


Return 'on' or 'off'
When the input is true, return 'on', otherwise, return 'off'.

3 månader ago

Solved


Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

3 månader ago

Solved


Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

3 månader ago

Solved


Unit Matrix
Given n, you should return an n-by-n unit matrix. Example: If input is n=2 then A = [ 1 0 0 1 ] If input ...

3 månader ago

Solved


Is the input divisible by 3?
Return true if the input is divisible by 3 and false if not.

3 månader ago

Solved


Square a Number
Given an input x, return y, which is equal to the square of x.

3 månader 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: Inpu...

3 månader ago

Solved


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

3 månader ago

Solved


Converting binary to decimals
Convert binary to decimals. Example: 010111 = 23. 110000 = 48.

3 månader ago

Solved


Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

3 månader ago

Solved


Convert given decimal number to binary number.
Convert given decimal number to binary number. Example x=10, then answer must be 1010.

3 månader ago

Solved


Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

4 månader ago

Solved


Put Two 1D matrices into one 1D matrix
Example: If input a = [1 2 3 4 5]; input b = [10 9 8 7 6]; then output will be, y_correct = [1 10 2 9 3 8 4 7 5...

4 månader ago

Solved


Binary code (array)
Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

4 månader ago

Solved


Pascal's Triangle
Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

4 månader ago

Solved


Min of a Matrix
Return the minimum value in the given matrix.

4 månader ago

Solved


Find the nearest integer
Given a vector of integers and a real number find the closest integer. EX: >> a = [2 4 5 6 8 10]; >> b = 4.6; >> nea...

4 månader ago

Solved


Divide by 4
Given the variable x as your input, divide it by four and put the result in y.

4 månader ago

Solved


Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

4 månader ago

Solved


Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock.
Submit your answer to this problem a multiple of 5 seconds after the hour. Your answer is irrelevant; the only thing that matte...

4 månader ago

Solved


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

4 månader ago

Solved


Count consecutive 0's in between values of 1
So you have some vector that contains 1's and 0's, and the goal is to return a vector that gives the number of 0's between each ...

4 månader ago

Solved


Insert zeros into vector
Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

4 månader ago

Solved


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

4 månader ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

4 månader 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...

4 månader ago

Solved


Rescale Scores
Each column (except last) of matrix |X| contains students' scores in a course assignment or a test. The last column has a weight...

4 månader ago

Solved


Find the Best Hotels
Given three input variables: * |hotels| - a list of hotel names * |ratings| - their ratings in a city * |cutoff| - the rat...

4 månader ago

Load more