Last active
December 17, 2015 06:58
Revisions
-
Matthias Knoll renamed this gist
May 13, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Matthias Knoll created this gist
May 13, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ # Coding Challenge 4 This weeks challenge is to write a so called "Pattern Chaser". ## Instructions #### Language JavaScript Expose a function called `bnt.patternChaser(str)` to the global namespace which takes one `string` as a parameter and returns `"yes [found pattern]"` or `"no null"`. The found pattern should be the longest pattern which can be found in the string. A pattern for this challenge will be defined as: * If at least 2 or more adjacent characters within the string repeat at least twice. So for example `"aabecaa"` contains the pattern `"aa"`, on the other hand `"abbbaac"` doesn't contain any pattern. * If str were `"aabejiabkfabed"` the output should be `"yes abe"`. * If str were `"123224"` the output should return `"no null"`. * The string may either contain all characters (a through z only), integers, or both. But the parameter will always be a string type. * The maximum length for the string being passed in will be 20 characters. * If a string for example is `"aa2bbbaacbbb"` the pattern is `"bbb"` and not `"aa"`. You must always return the longest pattern possible. ## Judging Criteria * ***Coding Style***: * Does the code lint in [JSLint](http://www.jslint.com/) with following settings: `/*jslint browser: true, plusplus: true, sloppy: true, stupid: false, indent: 4 */` * Use of language features * ***Execution Time*** * ***Lines of code*** * ***Elegance of solution*** #### BONUS!! Use the Google Closure Library. If you choose to use the library please create the module in the `goog.provide('bnt.PatternChaser');` namespace and make sure it still exposes the `bnt.patternChaser(str)` function. ## Deadline 19:00 - Tuesday 28th May