A Computer Science Enthusiast

Solved

Kaprekar Steps

6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

1 year ago

Solved

Crop an Image

A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. The element values ...

1 year ago

Solved

Find Rotated Substring

Given a string s1, find if a rotated version of s1 is present in a second string s2. For example, rotated version of some str...

1 year ago

Solved

Convert String to Morse Code

Convert a given string to international <http://en.wikipedia.org/wiki/Morse_code Morse Code> * Strings will only have [A-z], ...

1 year ago

Solved

Find vampire numbers

A <http://en.wikipedia.org/wiki/Vampire_number vampire number> is a number v that is the product of two numbers x and y such th...

1 year ago

Solved

Convert a structure into a string

Convert the contents of each fields into a string. Example with an input structure s with 2 fields : s.age = '33' s....

1 year ago

Solved

Reverse the Words (not letters) of a String

*Description* Change the words of a string such that the words appear in reverse order. You may assume that the string is a n...

1 year ago

Solved

letter yes yes & letter no no

Split a string into two strings, wherein the first string has all alphabetic letters and the second string has all the remaining...

1 year ago

Solved

Without the French accent please!

Suppress the French accent. Example 'Déjà présent' -> 'Deja present'

1 year ago

Solved

Find matching parenthesis

One of the most indispensable things about a great text editor for programming is the ability to quickly jump between matching p...

1 year ago

Solved

QWERTY Shift Code Decoder

Decode a string encoded using the QWERTY shift code. QWERTY shift code is where the message was touch typed but with an offse...

1 year ago

Solved

Smith numbers

Return true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at <http://en.wikipedi...

1 year ago

Solved

Fangs of a vampire number

A <http://en.wikipedia.org/wiki/Vampire_number vampire number> is a number v that is the product of two numbers x and y such tha...

1 year ago

Solved

Generalised Hamming Number

Inspired by Project Euler n°204 and Problem 1308 by James A generalised Hamming number of type n, has no prime factor larger ...

1 year ago

Solved

Add more zeros

Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1). For example: '1010' -> '100100' ...

1 year ago

Solved

Ordinal numbers

Given an integer n, return the corresponding ordinal number as a character string. For example, ord(1)='1st' ord(2)=...

1 year ago

Solved

Split a string into chunks of specified length

Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

1 year ago

Solved

Cell Counting: How Many Draws?

You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

1 year ago

Solved

Guess Cipher

Guess the formula to transform strings as follows: 'Hello World!' --> 'Ifmmp Xpsme!' 'Can I help you?' --> 'Dbo J ifmq zpv...

1 year ago

Solved

Triangle sequence

A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

1 year ago

Solved

Penny flipping - calculate winning probability (easy)

Two players are playing a fair penny flipping game. For each flip, the winner adds one penny from the loser's collection to his/...

1 year ago

Solved

Who is the smartest MATLAB programmer?

Who is the smartest MATLAB programmer? Examples: Input x = 'Is it Obama?' Output = 'Me!' Input x = 'Who ?' Ou...

1 year ago

Solved

Replace May with April

For instance, if the input is input_str = 'The flowers may bloom in April'; then the output is output_str = 'The flo...

1 year ago

Solved

Deleting an element in a matrix

For vector Grades=[98 56 78 34 100 88 87], delete the number 78 to get the following matrix Grades=[98 56 34 100 88 87] **re...

1 year ago

Solved

All capital?

Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

1 year ago

Solved

Guess

A random number between 1 and 10 is created for the variable y. Guess what its value is.

1 year ago

Solved

Y=X

Given an input variable x, output a variable y that is equal in value to x. Example: Input x = 1 Output y is 1 Inp...

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

1 year ago

Solved

Efficiency of a single phase Transformer

Calculate the efficiency of a single phase transformer whose KVA rating is A KVA, loading factor x,power factor p,full load copp...

1 year ago