Skip to content

Instantly share code, notes, and snippets.

View divmgl's full-sized avatar

Dexter Miguel divmgl

  • San Francisco, CA
  • 16:53 (UTC -12:00)
View GitHub Profile
@divmgl
divmgl / random.cpp
Last active January 7, 2017 05:05
Weighted random function
#include <iostream>
#include <array>
#include <map>
#include <random>
using std::cout;
using std::endl;
using std::string;
using std::array;
@divmgl
divmgl / permcheck.js
Created December 1, 2015 06:09
PermCheck Javascript 100%/100%
function solution(A) {
var L = A.length; // Length of the array
var X = ((L + 1) * L) / 2; // Sum from 1..L
var Y = 0; // Sum of evaluated values
var I = 0; // Counter
var F = []; // Found elements
var V = -1; // Container
while (I < L) { // Start searching the array
V = A[I]; // Get the value