Solved


Flip the vector from right to left
Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not to use d...

3 månader ago

Solved


GJam 2017 Kickstart: Parentheses (Large)
This Challenge is derived from <http://code.google.com/codejam/contest/6304486/dashboard#s=p2 GJam 2017 Kickstart Parentheses>. ...

3 månader ago

Solved


Independent direction vectors of a plane
Given the equation of a plan of the form ax+by+cz=d, return 2 independent direction vectors which could e.g. be used to determin...

3 månader ago

Solved


Palindrome Checker
Check to see if a given string is a palindrome (a word, phrase, or sequence that reads the same backward as forward). Output sh...

3 månader ago

Solved


Sum All Positive Elements
Output a scalar that is equal to the sum of all positive elements in a given vector/matrix. For Example: The sum of all positi...

3 månader ago

Solved


Reverse a string
Return a string with the characters in reverse order from a given input string Ex: my_str = "Ciao" function should output "...

3 månader ago

Solved


Diagonal Product of A Square Matrix
For a matrix A, calculate the product of its diagonal elements. * Assume all input matrices are square & corresponding element...

3 månader ago

Solved


Calculate the mean of each half of a matrix
Given a matrix with an even number of columns, n, return a 1-by-2 row vector where the first element is the mean of all the elem...

3 månader ago

Solved


Calculate Amount of Cake Frosting
Given two input variables r and h, which stand for the radius and height of a cake, calculate the surface area of the cake you n...

3 månader ago

Solved


Compute a sum
Write a function to compute the following sum Although a solution is available for general values of the coefficients, the co...

3 månader ago

Solved


The Prime Days of Christmas
On the first day of Christmas my true love sent to me partridges in a pear tree. On the second day of Christmas my true love s...

4 månader ago

Solved


Conditional transpose II
As in problem 60734, you're given two vectors, x and y, which might be row or a column vectors. Your task is to ensure that y ha...

4 månader ago

Solved


Conditional transpose
You're given two vectors of the same length, x and y, which might be row or a column vectors. Your task is to ensure that y has ...

4 månader ago

Solved


Remove the diagonal of a square matrix
Some Cody problems ask solvers to remove columns (e.g., CP 7), and others ask solvers to remove rows (e.g., CP 44033). Write a...

4 månader ago

Solved


Find the closest geyser prime
My wife and I celebrated our honeymoon and our recent anniversary in Yellowstone and Grand Teton National Parks. After returning...

4 månader ago

Solved


Sum the reciprocals of polygonal numbers
As explained in Cody Problem 60571, a polygonal number is the number of dots arranged in the shape of a regular polygon. For exa...

6 månader ago

Solved


Complete a 2nd order difference sequence
In Cody Problem 59791 ChrisR asks us to find the integer that completes a randomly sorted geometric sequence with one missing el...

6 månader ago

Solved


Pronounce digits
Given a number num, select the first d decimal places and pronounce the digits (in English). The function returns the pronunciat...

6 månader ago

Solved


Remove Adjacent Pairs
Given an array of integers where adjacent elements may be identical, your task is to remove these adjacent pairs. If removing on...

6 månader ago

Solved


List primes of the form xy+z
Consider three consecutive integers , , and . When is the number prime? For example, if or , then the results are 17 and 37, ...

6 månader ago

Solved


Perimeter of a Koch snowflake
A Koch snowflake is an iteratively generated (fractal) shape built out of successively smaller equilateral triangles by followin...

6 månader ago

Solved


Find polygonal numbers that are Blum integers
A polygonal number is the number of dots arranged in the shape of a regular polygon. For example, 15 is a triangular number beca...

6 månader ago

Solved


Determine whether a number is a Blum integer
A Blum integer is a semiprime—that is, the product of two distinct primes—whose factors have the form for some integer . The nu...

6 månader ago

Solved


Jigsaw 001: Intro 2x2 square. Pieces 128x128
This challenge is to re-assemble camerman.tif in grayscale from four 128x128 pieces into a 256x256 image. The pointer layou...

6 månader ago

Solved


Compute the totient summatory function
Cody Problem 656 deals with the totient function, denoted by which counts the numbers less than that are relatively prime to ....

7 månader ago

Solved


Compute the number of squares a knight can reach after n moves
Several Cody problems involve knights from chess. They have asked players to find a knight’s tour in a matrix (CP 96), determine...

7 månader ago

Solved


Compute Farey sequences
Problem statement The Farey sequence of order consists of fractions between 0 and 1 expressed in reduced form in increasing or...

7 månader ago

Solved


Secret Message and Acrostic
One of the simplest ways to hide a message involves utilizing uppercase letters. Given a text, collect all uppercase letters in...

7 månader ago

Solved


Reversing Maximal Ascending Subsequences
Create and return a new array that contains the same elements as the input array, but with the elements within each strictly inc...

7 månader ago

Solved


Largest Rectangle Area in a Histogram
Given a histogram represented by an array of integers, e.g., [2, 1, 4, 5, 1, 3, 3] : find the maximum area of a rectangle tha...

7 månader ago

Load more