Skip to content

Instantly share code, notes, and snippets.

View mcleary's full-sized avatar

Thales Sabino mcleary

View GitHub Profile
@mcleary
mcleary / nvidia-physx-test.cpp
Created July 11, 2016 13:31
Simple code that shows how to setup and use the NVIDIA Physx Engine.
//
// main.cpp
// PhysX-Test
//
// Created by Thales Sabino on 10/25/14.
//
//
#define _DEBUG
@mcleary
mcleary / fibonacci-factor.cpp
Created May 26, 2016 13:04
Fibonacci Factor
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int numbers_count;
@mcleary
mcleary / connected-sets.cpp
Created May 25, 2016 15:00
Connected Sets
#include <iostream>
#include <vector>
using namespace std;
typedef vector<vector<bool>> Matrix;
int current_matrix_size = 0;
bool is_valid(Matrix& m, int i, int j)
@mcleary
mcleary / meeting-schedules.cpp
Created May 25, 2016 02:35
Meeting Schedules
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
void print_timespan(int start_time, int end_time)
{
@mcleary
mcleary / shortest-sub-segment.cpp
Created May 24, 2016 17:47
O(n) string shortest subsegment
#include <cmath>
#include <cstdio>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <iostream>
#include <iterator>
@mcleary
mcleary / naive-shortest-subsegment.cpp
Last active May 24, 2016 01:00
Naive Shortest Sub-Segment
#include <cmath>
#include <cstdio>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <string>
#include <iostream>
#include <iterator>
#include <sstream>
@mcleary
mcleary / diag_diff.rb
Created May 22, 2016 23:55
Diagonal Difference
M = [[11, 2, 4], [4, 5, 6], [10, 8, -12]]
main_diag = 0
sec_diag = 0
for i in 0..2
main_diag += M[i][i]
sec_diag += M[i][3 - i - 1]
end
@mcleary
mcleary / install-clang.sh
Created May 20, 2016 12:30
Script do download, compile and install clang
#!/bin/sh
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../..
mkdir llvm-build
cd llvm-build
@mcleary
mcleary / LU.cpp
Created May 2, 2016 13:24 — forked from bergolho/LU.cpp
// Resolve um sistema linear pela substituição LU.
double* LU (double **A, double *b)
{
int i, j, k, p;
double *pivot = new double[n];
double Amax, t, m, r, Mult;
// 1 PASSO: Transformar a matriz A do problema em duas matrizes triangulares L e U.
for (i = 0; i < n; i++)
pivot[i] = i;
for (j = 0; j < n-1; j++)
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>
#if 0
// Assossiative operations