Skip to content

Instantly share code, notes, and snippets.

View abatilo's full-sized avatar

Aaron Batilo abatilo

View GitHub Profile
#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include <vector>
using namespace std;
bool is_valid_parens(const string &parens) {
stack<char> s;
for (size_t i = 0; i < parens.length(); ++i) {
node *insert(node *root, int value) {
node *current = root;
node *prev;
if (root == NULL) {
root = (node *)malloc(sizeof(node));
root->data = value;
root->left = NULL;
root->right = NULL;
return root;
#include <iostream>
#include <vector>
int32_t make_change(const std::vector<int32_t> &denominations,
const int32_t &amount,
std::vector<int32_t> &coin_count,
std::vector<int32_t> &coins_used) {
for (int32_t i = 0; i < amount + 1; ++i) {
int32_t count = i;
int32_t new_coin = 1;
#include <stdlib.h>
#include <string.h>
int main(int argc, char* *argv)
{
// FOR STREAM VIEWERS
// A buddy of mine into security/cryptography challenged me to this
// "very easy" problem.
// Now I'm making a friend of mine and YOU guys try and solve the same
// challenge
/* Aaron Wilson
* Dr. Kalita
* CS 4720 - Design and Analys of Algorithms
* May 4, 2016
* Email: awilson8@uccs.edu
*
* Assignment 4, Problem 2: Dijkstra's Algorithm
*/
#include <iostream>
@abatilo
abatilo / gist:4e7e0fc873fd0edd0f03e0aa8c77cb10
Created May 30, 2016 17:42 — forked from lqd/gist:1c841dea193698bf50fefa19c6b3fb99
Some of my favorite development streams and shows
Why coding streams/shows are interesting to me: in some livestreams, the experience is very similar to pair programming,
but those people are experts. In VODs, it's more about problem solving and learning skills and approaches. The devs are really good
at what they do and there is *always* a lot to learn.
In no particular order:
1) Handmade Hero
About the author: Casey Muratori. Worked at RAD.
Description and why I like it: It kinda started the whole thing for me. Casey is coding a complete game and engine on stream,
from scratch, one hour a day. He knows what he's doing on so many of the domains of game development and regular programing,
@abatilo
abatilo / abs.c
Created July 12, 2016 20:58
Timing different abs implementations for Aaron
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
double absd(double n) {
unsigned long *gg = (unsigned long int *)&n;
*(gg) &= 0x7FFFFFFFFFFFFFFFull;
return n;
}
import java.util.*;
public class Solution {
public boolean repeatedSubstringPattern(String str) {
int length = str.length();
if (length <= 1) return false;
List<Integer> factors = new ArrayList();
// Factor
for (int i = 1; i * 2 <= length; ++i) {
@abatilo
abatilo / last.sh
Created January 22, 2017 07:08
This script will print all java files found recursively from the current directory, and then print the ones that have not been involved in a git commit in some number of months
#!/bin/bash
# This script will print all java files found recursively from the current directory, and then print the ones that
# have not been involved in a git commit in some number of months
#
# Based on:
# https://hackerific.net/2016/04/30/git-file-age-a-script-to-show-when-files-were-last-modified-in-git/
find . -name *.java | xargs -I § git log -1 --pretty="format:%ct %cr %h §;" § | tr ';' '\n' | sort | cut -f 2- | grep "month"
@abatilo
abatilo / Solution.java
Created January 28, 2017 03:23
Binary watch
import java.util.*;
public class Solution {
private int numberOfOneBits(int num) {
int count = 0;
while (num != 0) {
if ((num & 1) == 1) {
++count;
}
num >>= 1;
}