Skip to content

Instantly share code, notes, and snippets.

@eriksjaastad
eriksjaastad / HackerRank-js.md
Last active September 9, 2015 11:54
Hacker Rank

####Diagnol Difference

Problem Statement

You are given a square matrix of size N×N. Calculate the absolute difference of the sums across the two main diagonals.

Input Format

The first line contains a single integer N. The next N lines contain N integers (each) describing the matrix.

@eriksjaastad
eriksjaastad / Codility-js.md
Last active October 4, 2015 00:41
Codility algorithm solutions in JavaScript with better examples of the questions

###Time Complexity O(1) is constant time, no matter how much data there is, it will take the same amount of time to find the answer
O(log n) is cutting the search area in half each time
O(n) is looping through each item once
O(n2) is looping through twice
0(nn) is looping through each value and having to do something with each value based on how many values came before it
####TapeEquilibrium rewrite
A is an Array = [3,1,2,4,3]
N is the length of A