/may-6-2015

Primary LanguageJavaScript

May 6, 2015

Problem #1 - Is Palindrome

Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like “racecar”. For additional complexity discount white space and punctuation so that "never odd or even" would be accepted as well.

Problem #2 - Mortgage Calculator

Calculate the monthly payments of a fixed term mortgage over given Nth terms at a given interest rate. Also figure out how long it will take the user to pay back the loan. For added complexity, add an option for users to select the compounding interval (Monthly, Weekly, Daily, Continually).

Problem #3 - Counting Sundays

You are given the following information, but you may prefer to do some research for yourself.

1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

Problem #4 - Efficient Queue

A Queue is a datastructure which has two methods, enqueue and dequeue, that accepts data in a first-in first-out manner. Enqueue pushes data on to the back of the queue and dequeue pulls an item off of the front. A stack is datastructure which has two methods, push and pop, that accepts data in a first-in last out manner. Push puts an item onto the top of the stack, and pop removes an item from the top of the stack. In most languages a stack can be efficiently represented with an array. Create a queue using 2 stacks.

Problem #5 - Parentheses Matching

Create a function which accepts a string containing parentheses and returns true or false depending if the the parentheses are well matched. For example: if the string is "(hello (world))", then the output should be true, but if the string is "((hello (world))" the the output should be false because the parentheses do not correctly match up. Only "(" and ")" will be used. If the string contains no parentheses return true.