Image for post
Image for post

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!

Image for post
Image for post

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. …


Image for post
Image for post

A linear search is a common search algorithm built into several Javascript methods where each element in an array is checked to determine if it is the value that you want. Javascript methods that utilize linear search include:

Let’s break down how .indexOf works for an example.

Build a function that accepts an array and a value. If the value is found return the index of that element. If it is not found return -1.

Image for post
Image for post

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. …


Image for post
Image for post

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.

Image for post
Image for post

Simply uncomment the amazon part. We will come back to this later. …

About

Andrew Casarsa

software engineer in training

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store