Angular Rocks

Sep 10, 2016

And so is dynamic programming

Algorithms With a Twist! Introducing Javascript

Sep 10, 2016

This past week at Viking Code School we were introduced to Javascript. It’s been an interesting transition from the friendly, English-like syntax of Ruby to the harsh, low-level feel of Javascript. It certainly doesn’t hold your hand, that’s for certain. On the bright side Javascript makes good use of first-class functions and callbacks, which certainly lends it a sense of flexibility if not neatness. That said, this week I will be covering an algorithm in Javascript rather than the usual Ruby, so let’s get cracking!

The Problem

Suppose that you are given an array A of n integers. You are also given a positive integer k. Your task is to find and print the total number of (i, j) such that i < j and A[i] + A[j] is evenly divisible by k. Think you could do it? Let’s take a look at a potential naive approach.

Magic Indices Algorithm

Aug 8, 2016

This week's post will be a bit shorter than usual as VCS has kept us neck deep in new material. So without further ado, let's get into it.

The Problem

Considering a simple array, a magic index can be described as the index that matches its own value. For instance given the array

  [-3, -2, 1, 3, 5]

3 would be the magic index because it matches its corresponding value in the array.

The problem is thus. Given a sorted array of distinct integers, write a method to find a magic index if one exists, otherwise return false.

Anyone with a week's worth of coding under the belt could get this right away. They might answer with something like this.

  def find_magic_index(arr)

InstaUberSnapagram-Viking Code School Week 4

Aug 1, 2016

So this past week of Viking Code School we were finally introduced to Ruby on Rails. While Rails won’t be the only framework we learn during the course, it is the one we will spend the most time on. The meat and potatoes of the course, if you will. As you can imagine, I’ve been really excited to finally get my hands on it. I believe this is the point where we truly begin making the transition from toy apps to real ones that actually serve some sort of purpose. My reasons for believing this are two-fold. One, we have just begun to touch on databases, which are crucial to any truly comprehensive application.