Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View CraigRodrigues's full-sized avatar

Craig Rodrigues CraigRodrigues

View GitHub Profile
@CraigRodrigues
CraigRodrigues / dictionary.c
Created September 8, 2016 00:10
CS50 Problem Set 5 - Mispellings
/**
* dictionary.c
*
* Computer Science 50
* Problem Set 5
*
* Implements a dictionary's functionality.
*/
#include <stdbool.h>
@CraigRodrigues
CraigRodrigues / palindrome.c
Created August 12, 2016 01:01
Project Euler 4 - Largest Palindrome Product
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
bool isPalindrome(int num);
int main(void)
{
@CraigRodrigues
CraigRodrigues / circular_array.c
Created August 4, 2016 12:48
HackerRank - Algorithms - Warmup - Circular Array Rotation
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
// https://www.hackerrank.com/challenges/circular-array-rotation
int main(void)
{
int n, k, q;
@CraigRodrigues
CraigRodrigues / timeconversion.c
Created August 4, 2016 12:17
HackerRank - Algorithms - Warmup - Time Conversion
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(void)
{
@CraigRodrigues
CraigRodrigues / triplets.c
Last active August 3, 2016 14:43
HackerRank - Algorithms - Warmup - Compare the Triplets
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int alice_score = 0;
@CraigRodrigues
CraigRodrigues / greedy.c
Created August 3, 2016 02:40
CS50 Pset1 - Greedy
#include <stdio.h>
#include <cs50.h>
#include <math.h>
/** Write a program that first asks the user how much change is owed
and then spits out the minimum number of coins with which said change
can be made.*/
int main(void)
{
@CraigRodrigues
CraigRodrigues / reverse.c
Last active July 9, 2016 14:22
Reverse String - Write a function that takes a string as input and returns the string reversed.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char* reverseString(char* s) {
int length = 0, i = 0;
length = strlen(s);
char temp[1];
@CraigRodrigues
CraigRodrigues / degree.c
Last active July 8, 2016 21:01
[2016-06-27] Challenge #273 [Easy] Getting a degree (with bonus)
/**
* degree.c
*
* Reddit Daily Programmer Challenge #273 [EASY]
* Getting a degree
*
* https://www.reddit.com/r/dailyprogrammer/comments/4q35ip/20160627_challenge_273_easy_getting_a_degree/
*
*/
@CraigRodrigues
CraigRodrigues / whodunit.c
Created July 7, 2016 16:51
CS50 pset4 - "Whodunit"
/**
* whodunit.c
*
* Computer Science 50
* Problem Set 4
*
* Copies a BMP piece by piece, with slight variation.
*/
#include <stdio.h>
@CraigRodrigues
CraigRodrigues / recover.c
Created July 7, 2016 16:50
CS50 pset4 - "Recover"
/**
* recover.c
*
* Computer Science 50
* Problem Set 4
*
* Recovers JPEGs from a forensic image.
*/
#include <cs50.h>