Solved


Vector of digits (★★)
Given a positive integer x, construct a vector y with all the digits of x in the order of appearance in x. Thus, if x = 172...

7 days ago

Solved


Generate n equally spaced "intervals" between -x and x (★)
Given n and x, return a list of numbers (in ascending order) that divides the interval [-x x] into n equal-length intervals. ...

7 days ago

Solved


Create a vector of n alternating ones and zeros (★★)
Given n, your output should be a vector y of numbers such that the first number is 1 and the numbers following it alternate betw...

7 days ago

Solved


Corresponding ASCII code.
Given the number, the output will show the corresponding ASCII code.

7 days ago

Solved


Vector with a repeated entry
Create a row vector of length n, filled with 4's. For example, if n = 3, output = [4 4 4]

7 days ago

Solved


Sum of terms in a series 1 (★★★)
Given x and n, compute the following sum: |x|+|x|^(1/2)+|x|^(1/3)+|x|^(1/4)+|x|^(1/5) ... + |x|^(1/n) where ||x|| indica...

7 days ago

Solved


Magnitude of a vector (★★★)
Given a vector x with values [ x1, x2, x3, ..., xn ], compute the magnitude (or length) of the vector which is given by href ...

7 days ago

Solved


Create a vector of the first n odd numbers (★)
If n = 10, your program should return a vector y, where y = [1 3 5 7 9 11 13 15 17 19].

7 days ago

Solved


Vector raised to a power, element-wise (★)
Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

7 days ago

Solved


Function 1 (★)
Compute the value of <<https://i.imgur.com/AxKWLmE.gif>> for any given positive x.

7 days ago

Solved


Convert matrix to 3D array of triangular matrices
Given a 2D numeric array x in which each column represents the vectorized form of an upper triangular matrix, return a 3D array ...

7 days ago

Solved


Must be in the front row...
You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

7 days ago

Solved


Magnet and Iron
(Inspired from <http://www.mathworks.com/matlabcentral/cody/problems/112 Problem 112: Remove the air bubbles>) Iron (atomic n...

7 days ago

Solved


Swap the first and last columns (★★)
(copy of Prob 19) Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becom...

11 days ago

Solved


Easy Sequences 39: Perfect Squares in Pascal's Triangle
Consider the 2nd, 3rd and 4th diagonals of the Pascal's Triangle, shown highlighted below: ...

19 days ago

Solved


Number of paths on a 3d grid
This problem is inspired by <https://www.mathworks.com/matlabcentral/cody/problems/1483-number-of-paths-on-a-grid>, which you mi...

19 days ago

Solved


Number of paths on a grid
Consider a grid formed by n vertices vertically down, and m vertices horizontally right. Your starting point is at the top lef...

19 days ago

Solved


Newton’s First Law – Net Force in Equilibrium
At a manufacturing plant operated by Reliance Industries in Jamnagar, a heavy equipment box rests on the factory floor. Even th...

20 days ago

Solved


Newton’s Second Law – Gravitational Force on a Falling Object
During a relief mission organized by the Indian Air Force, supply packages are dropped from aircraft to remote flood-affected ar...

20 days ago

Solved


Newton’s Second Law – Acceleration of Connected Objects
Engineers at Boston Dynamics are testing two robots connected by a rope on a frictionless surface. Robot A pulls Robot B using ...

20 days ago

Solved


Newton’s Second Law – Force Produced by a Car Engine
Automotive engineers at Tata Motors are testing a new electric car prototype on a straight test track in Pune. The engineers wa...

20 days ago

Solved


Newton’s Third Law – Action and Reaction in Rocket Launch
Scientists at SpaceX are testing a rocket engine before launch from their facility. When the rocket pushes exhaust gases downwa...

20 days ago

Solved


Newton’s Second Law – Normal Force in an Accelerating Elevator
Engineers at Otis Elevator Company are testing a new high-speed elevator installed in the Burj Khalifa. When the elevator accel...

20 days ago

Solved


Newton’s Second Law – Motion on an Inclined Plane
In the mountainous region near Manali, a rescue team is testing a motorized emergency vehicle designed to climb steep slopes. E...

20 days ago

Solved


Newton’s First Law – Force Needed to Start Motion
At Indira Gandhi International Airport, a heavy suitcase is sitting on a stationary conveyor belt. The belt is initially at rest...

20 days ago

Solved


Newton’s Second Law – Acceleration of a Mars Rover
At NASA's robotics laboratory, engineers are preparing a prototype rover for a future mission to Mars. Before sending the rover...

20 days ago

Solved


Newton’s Second Law – Force Required to Accelerate a Rocket Cart
At ISRO's training center, engineering students are testing a small rocket-powered cart on a straight frictionless track. The ca...

20 days ago

Solved


Given a Polyshape_01 (ps) Return its Perimeter, Area, and Centroid.
Return the perimeter (P) of a polyshape object, which is the sum of the lengths of its boundaries. Return the total area (A) of...

20 days ago

Solved


5-year Annedversaries
This is the Bonus Round problem for the 2025 Cody Contest. Attend the watch party on Friday, March 27 to see how 6 champions fro...

21 days ago

Solved


Angular Velocity of a Falling Rod Pivoted at One End (Energy + Rotation)
Engineers at Indian Institute of Technology Bombay are designing a rotating docking arm for a future space station. The arm is m...

29 days ago

Load more