Community Profile

photo

Mohammed Shafiq


Attivo dal 2017

Statistiche

  • CUP Challenge Master
  • Solver

Visualizza badge

Content Feed

Visto da

Risolto


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...

quasi 5 anni fa

Risolto


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

quasi 5 anni fa

Risolto


Homogeneous lines and points in 2D: problem 1
In high school we learn the line equation y = mx + c where m is the gradient and c is the intercept. However this form is prob...

circa 5 anni fa

Risolto


Sum of unique multiples of 3 and 5
If we list all the natural numbers up to 15 that are multiples of 3 or 5, we get 3, 5, 6, 9, 10, 12 and 15. The sum of these mul...

oltre 5 anni fa

Risolto


Is my wife right?
Regardless of input, output the string 'yes'.

oltre 5 anni fa

Risolto


Generate N equally spaced intervals between -L and L
Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

oltre 5 anni fa

Risolto


First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

oltre 5 anni fa

Risolto


We love vectorized solutions. Problem 1 : remove the row average.
Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

oltre 5 anni fa

Risolto


Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

oltre 5 anni fa

Risolto


Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

oltre 5 anni fa

Risolto


Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

oltre 5 anni fa

Risolto


Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

oltre 5 anni fa

Risolto


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

oltre 5 anni fa

Risolto


Palindrome Check
Check whether the entire matrix is palindrome or not. Example matrix = [7 8 7] matrix_reverse = [7 8 7] So the mat...

oltre 5 anni fa

Risolto


Replacing a row
For matrix G=[1 2 3; 4 5 6; 7 8 9] Replace the 2nd row with 8s **remember to create matrix G

oltre 5 anni fa

Risolto


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

oltre 5 anni fa

Risolto


Perimeter of a semicircle
Given the diameter d, find the perimeter of a semicircle

oltre 5 anni fa

Risolto


The proportion of NaN in the data
If NaN occupies less than half of the input data, return 1, otherwise return 0. eg. input x = [1 2 NaN ; 4 NaN 6] >>> out...

oltre 5 anni fa

Risolto


Second Diagonal
Transpose the matrix from it's second diagonal.

oltre 5 anni fa

Risolto


Draw 'O' !
Given n as input, generate a n-by-n matrix 'O' using 0 and 1 . example: n=4 ans= [1 1 1 1 1 0 0 1 ...

oltre 5 anni fa

Risolto


Draw 'I'
Given n as input, draw a n-by-n matrix 'I' using 0 and 1. example: n=3 ans= [0 1 0 0 1 0 0 1 0] n=...

oltre 5 anni fa

Risolto


Prime numbers between a , b.
Find all prime number between a & b (including a and b). example: a=100 b=120 y= [101 103 107 109 113]

oltre 5 anni fa

Risolto


how many of the entries are positive?
Given x= sin(linspace(0,10*pi,100)), how many of the entries are positive?

oltre 5 anni fa

Risolto


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

oltre 5 anni fa

Risolto


Clean the List of Names
Given a list of names in a cell array, remove any duplications that result from different capitalizations of the same string. So...

oltre 5 anni fa

Risolto


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

oltre 5 anni fa

Risolto


Maximum running product for a string of numbers
Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

oltre 5 anni fa

Risolto


Extract leading non-zero digit
<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

oltre 5 anni fa

Risolto


Remove all the words that end with "ain"
Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

oltre 5 anni fa

Risolto


Sums with Excluded Digits
Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9. no...

oltre 5 anni fa

Carica altro