multiply by three
Given the variable x as your input, multiply it by 3 and put the result equal to y.
Examples:
Input x = 2
Output y is ...
3年弱 前
解決済み
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...
3年弱 前
解決済み
vectors counting by 5
Create a vector with numbers from x_min to x_max in increments of 5.
3年弱 前
解決済み
Approximate e
Given a and n, compute and approximation to f = a * e ^ n, without the use of exp, string operations, or floating point numbers....
3年弱 前
解決済み
King's Cage
Given the position of the king on the chessboard, determine the minimum number of steps it'll require to reach the destination.
...
3年弱 前
解決済み
Back to basics 6 - Column Vector
Covering some basic topics I haven't seen elsewhere on Cody.
Given an input vector, output true or false whether it is a colu...
3年弱 前
解決済み
resistor ladder
* You have a bunch (an odd number N) of identical resistors (each R ohms), a good battery (V volts), and a high impedance voltme...
Identify the heavier bag
There are N=2^n bags of rice looking alike, N-1 of which have equal weight and one is slightly heavier. The weighing balance is ...
Find the solution of algebraic equation
Find the solution of algebraic equation of the form
an*x^n + a(n-1)*x^(n-1) + (an-2)*x^(n-2)+...... a2*x^2 + a1*x^1 + a0 = 0;
...
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年弱 前
解決済み
Divide by 4
Given the variable x as your input, divide it by four and put the result in y.
3年弱 前
解決済み
Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point.
Exampl...
3年弱 前
解決済み
Energy of a photon
⚛ ☢ ⚛ ☢ ⚛ ☢ ⚛
Given the frequency F of a photon in giga hertz.
Find energy E of this photon...
3年弱 前
解決済み
Find the peak 3n+1 sequence value
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...
3年弱 前
解決済み
Interpolator
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end),...
3年弱 前
解決済み
Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...
3年弱 前
解決済み
Weighted average
Given two lists of numbers, determine the weighted average as follows
Example
[1 2 3] and [10 15 20]
should result in
33.3...