Recently, I came across a logic problem that is commonly known as Einstein’s Riddle or Einstein’s Problem because it is rumored to have been invented by Albert Einstein when he was just a little boy.
The riddle is a common logic problem used as a benchmark evaluation level of computer algorithms for solving constraint satisfaction problems.
This riddle is more Sherlock Holmes than Sphinx. There are no tricks or confusing wordplay to this one, and much like Holmes would, you’ll solve this mystery with your powers of logic and deduction!
Here’s the riddle:
Five houses painted five different colors stand in a row. One person of a different nationality lives in each house. The five homeowners all drink some type of beverage, smoke a certain cigar brand, and have a certain kind of pet. But none of the owners drink the same beverage, smoke the same type of cigar, or have the same pet. …
Let’s break down how .indexOf works for an example.
The above code is what indexOf does behind the scenes whenever you call it.
First, we use a for loop to iterate over the array then for each element we check if that element’s value is equal to the passed in argument of n. …
The purpose of this very simplified set up of AWS is to teach people the basics. For business purposes, I would recommend using more strict access controls. This set up is perfect for an educational project or for someone who wants to get a basic understanding of AWS. Well, with that out of the way, let’s get started.
Create your Rails app with rails new <app_name>. Then you’ll want to jump into your config/storage.yml file. There you’ll see that Amazon and other storage locations for cloud services are ready to be commented in out of the box with rails.
Simply uncomment the amazon part. We will come back to this later. …