This file contains 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 characters
def rot13(secret_messages) | |
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz '.split('') | |
rot13 = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm '.split('') | |
lookup_hash = {} | |
alphabet.zip(rot13) do |key, value| | |
lookup_hash[key] = value | |
end |
This file contains 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 characters
class Challenges | |
# www.projecteuler.net | |
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
# Find the sum of all the multiples of 3 or 5 below 1000. | |
def multiples_of_3_and_5 | |
(1...1000).select { |n| n if (n % 3 == 0) || (n % 5 == 0) }.inject(:+) | |
end | |
end | |
puts "challenge 1: #{Challenges.new.multiples_of_3_and_5}" |
This file contains 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 characters
# You've discovered the Shopify Store 'Shopicruit'. | |
# Since you're obsessed with lamps and wallets, you want to buy every single lamp | |
# and wallet variant they have to offer. | |
# By inspecting the Javascript calls on the store you discovered that the shop lists products | |
# at http://shopicruit.myshopify.com/products.json. | |
# Write a program that calculates how much all lamps and wallets would cost you. | |
# Attach your program (any language) and answer in your reply. | |
require 'net/http' | |
require 'json' |
This file contains 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 characters
{"version":1,"resource":"file:///c%3A/Repos/my-angular-specs/src/app/app.component.ts","entries":[{"id":"OAmg.ts","timestamp":1664325909752},{"id":"xq9U.ts","timestamp":1664326221371},{"id":"IUeI.ts","timestamp":1664326232490},{"id":"7mYA.ts","timestamp":1669679768382},{"id":"ZAqs.ts","source":"undoRedo.source","timestamp":1669679774107}]} |
This file contains 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 characters
/** | |
* | |
*** Fun with Anagrams *** | |
* | |
* Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order. | |
* Example | |
* str = ['code', 'doce', 'ecod', 'framer', 'frame'] | |
* | |
* 'code' and 'doce' are anagrams. Remove 'doce' from the array and keep the first occurrence 'code' in the array. |
This file contains 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 characters
fibonacci function(n, cache) { | |
cache = cache || {}; | |
if (n === 0) return 0; | |
if (n === 1) return 1; | |
if (cache[n]) return cache[n]; | |
return cache[n] = this.fibonacci(n - 1, cache) + this.fibonacci(n - 2, cache); | |
}; |