Commits
Comments (0)
Files changed (10)

+0 65greplinchallenge/challenge.notes

+0 64greplinchallenge/fib.py

+0 25greplinchallenge/gettysburg.py

+0 43greplinchallenge/subsets.py

+0 55greplinchallenge/subsets2.py

+65 0praxis/greplinchallenge/challenge.notes

+64 0praxis/greplinchallenge/fib.py

+25 0praxis/greplinchallenge/gettysburg.py

+43 0praxis/greplinchallenge/subsets.py

+55 0praxis/greplinchallenge/subsets2.py
greplinchallenge/fib.py
greplinchallenge/gettysburg.py
gettysburg = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth"
greplinchallenge/subsets.py
This is a naive solution which brute forces all subsets. I verified it gave the correct results, then didn't think any more of it.
greplinchallenge/subsets2.py
This is a dynamic solution which runs efficiently. I did not think of this approach, but implemented it from the description at http://programmingpraxis.com/2010/11/09/subsetsums/.
praxis/greplinchallenge/challenge.notes
+Offered at https://www.greplin.com/jobs, which points to http://challenge.greplin.com/. Below descriptions taken from that site.
+ Welcome to the Greplin Programming Challenge. You should try to complete all three levels in a single sitting. It should take anywhere from 20 minutes to 2 hours.
+ Embedded in this block of text is the password for level 2. The password is the longest substring that is the same in reverse.
+ To get the password for level 3, write code to find the first prime fibonacci number larger than a given minimum. For example, the first prime fibonacci number larger than 10 is 13.
+ You will receive additional instructions at that time. For the second portion of this task, note that for the number 12 we consider the sum of the prime divisors to be 2 + 3 = 5. We do not include 2 twice even though it divides 12 twice.
+ Step 1. Use your code to compute the smallest prime fibonacci number greater than 227,000. Call this number X.
+ For the final task, you must find all subsets of an array where the largest number is the sum of the remaining numbers. For example, for an input of:
+ Here is the list of numbers you should run your code on. The password is the number of subsets. In the above case the answer would be 4.
praxis/greplinchallenge/fib.py
praxis/greplinchallenge/gettysburg.py
+gettysburg = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth"
praxis/greplinchallenge/subsets.py
+This is a naive solution which brute forces all subsets. I verified it gave the correct results, then didn't think any more of it.
praxis/greplinchallenge/subsets2.py
+This is a dynamic solution which runs efficiently. I did not think of this approach, but implemented it from the description at http://programmingpraxis.com/2010/11/09/subsetsums/.
greplinchallenge/challenge.notes