Skip to content

Instantly share code, notes, and snippets.

View henrya2's full-sized avatar

Henry Read henrya2

  • Shanghai, China
  • 11:43 (UTC +08:00)
View GitHub Profile
-- this is an example
group: nameOfTheNewGroup
A = {
a:string, b:number
example, 42
}
@henrya2
henrya2 / MergeSortAndCount.cpp
Created January 31, 2013 01:31
A simple merge sort algorithm with Counting Inversions implementation in C++
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
template <typename T>
long long mergeSortAndCountInversions(T* arr, int size)
{
int m;
if (size <= 1)
@henrya2
henrya2 / ProjectEuler_Problem17.cpp
Last active October 10, 2015 21:58
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be us
#include <stdio.h>
int numLetters1_19[] =
{
sizeof("one") - 1,
sizeof("two") - 1,
sizeof("three") - 1,
sizeof("four") - 1,
sizeof("five") - 1,
sizeof("six") - 1,