Community Profile

# Ahmos Sansom

223 total contributions since 2009

PhD in Applied mathematics from the University of Nottingham.

Work in the Energy industry

View details...

Contributions in
View by

Solved

Find the sum of the elements in the "second" diagonal
Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

6 days ago

Solved

Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

6 days ago

Solved

Rotate and display numbered tile
Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west. If th...

7 days ago

Solved

Connect blocks in a model
Connect the blocks in the model to produce the following signal: <<http://blogs.mathworks.com/images/seth/cody/connect-blocks...

7 days ago

Solved

Trimming Spaces
Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

7 days ago

Solved

Compute Fibonacci Number
Compute the _n_-th Fibonacci Number f(0) = 0, f(1) = 1, f(2) = 1, f(3) = 2, ... f(42) = 267914296

10 days ago

Solved

Determine if a Given Number is a Triangle Number
*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

10 days ago

Solved

Project Euler: Problem 1, Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

10 days ago

Solved

Stuff the Board
You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

11 days ago

Solved

Twist 'n' Match
Given n and m, construct an n-by-n matrix a such that a, when rotated 90 degrees and compared with itself, matches itself in exa...

11 days ago

Solved

Angle between Two Vectors
The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and ve...

11 days ago

Solved

Angle between two vectors
You have two vectors , determine the angle between these two vectors For example: u = [0 0 1]; v = [1 0 0]; The a...

11 days ago

Solved

Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

11 days ago

Solved

Number of 1s in the Binary Representation of a Number
*Description* Return the number of 1s in the (unsigned integer) binary representation of a number. This function should be ab...

11 days ago

Solved

Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

11 days ago

Solved

Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

11 days ago

Solved

Make one big string out of two smaller strings
If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...

11 days ago

Solved

Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];

11 days ago

Solved

Elapsed Time
Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

11 days ago

Solved

Scoring for oriented dominoes
Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...

14 days ago

Solved

Quote Doubler
Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

14 days ago

Solved

Making change
Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

14 days ago

Solved

De-dupe
Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

14 days ago

Solved

Arrange Vector in descending order
If x=[0,3,4,2,1] then y=[4,3,2,1,0]

14 days ago

Solved

inner product of two vectors
inner product of two vectors

14 days ago

Solved

Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

14 days ago

Solved

Balanced number
Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

14 days ago

Solved

Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

14 days ago

Solved

Counting Money
Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: \$99,999.99. E...

14 days ago

Solved

Replace NaNs with the number that appears to its left in the row.
Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

14 days ago