| layout | title | published | permalink | description |
|---|---|---|---|---|
normal |
SRM 2014 Web developers |
true |
srm/ |
Codebrahma SRM Questions |
- You have 90 minutes time.
- Each question has a fiddle associated to it, fork the fiddle and implement the solution on the browser and save your answer. Call one of the Codebrahma team members and get your output verified.
- There are infinite ways to solve these problems. If two people submit identical solutions, both of them will be rejected.
- If the student is not comfortable with Javascript, he/she can use codepad.org and solve it any preferred language.
- Note: The last question needs to be solved only in Javascript and has bonus marks
- Submit your responses by filling this form.
If we list all the natural numbers below 16 that are multiples of 3 or 5 and not multiples of 3 and 5, we get 3, 5, 6 and 9, 10, 12 (not 15 as it's a multiple of both 3 and 5). The sum of these multiples is 45.
Write a function which takes in a number n, and returns the sum of all numbers below n which are multiples of 3 or 5, but not 3 and 5.
Regular expressions are used extensively across programming languages for string/pattern matching.
Write a function which takes in 2 strings, pattern and query, and returns boolean value which indicates whether the query matches the pattern.
Please dont use built in regex functions or third party code.
Possible query patterns.
- (*) —> 0 or many repetitions
- (|) —> OR
- (?) —> 0 or 1 repetitions
Example:
{% highlight javascript %} function("ab*", "ab"){} // should return true function("ab*", "abbbbb"){} // should return true function("abcd?e", "abbbbccccce"){} // should return true function("ab*", "abba"){} // should return false
function("ab|ba", "ab"){} // should return true function("ab|ba", "ba"){} // should return true
function("ab?", "a"){} // should return true function("ab?", "abb"){} // should return false
function("nith?in", "nitin"){} // should return true {% endhighlight %}
Observe the following video carefully and implement the functionality in the given fiddle.
The text box takes in a integer "n". Once you press the submit button. "n" buttons, ranging from 1 to n are created. When you click on one of those n buttons. The numbers are shifted to the right.
<iframe src="//player.vimeo.com/video/103901971" width="500" height="375" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>Button Game from CodeBrahma on Vimeo.
In case the video isn't working refer [this](/images/srm puzzle.gif).