This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdio.h" | |
// find the max number in a list/array | |
// n is the last index of the array | |
int arr_max(int arr[], int max, int n) | |
{ | |
//base case | |
if (n == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
/** | |
* Caesar.c | |
* A program that encrypts messages using Caesar’s cipher. Your program must | |
* accept a single command-line argument: a non-negative integer. Let’s call it | |
* k for the sake of discussion. If your program is executed without any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* recover.c | |
* | |
* Computer Science 50 | |
* Problem Set 4 | |
* | |
* Recovers JPEGs from a forensic image. | |
*/ | |
#include <cs50.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SHEET_NAME = 'COMPLETION REPORT'; | |
function getAverage(colName) { | |
const sheet = SpreadsheetApp.getActiveSheet(); | |
const data = sheet.getDataRange().getValues(); | |
const col = data[0].indexOf(colName); | |
if (col != -1) { | |
const completions = sheet.getRange(2,col+1,sheet.getMaxRows()).getValues().map(x => x[0]).filter(x => x !== ''); | |
const completionTotal = completions.reduce((a, b) => a + b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <math.h> | |
// calculates the number of digits in the card number | |
int getCardDigits(long long card_num) | |
{ | |
int card_digits = (int)log10(card_num) + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* resize.c | |
* | |
* Computer Science 50 | |
* Problem Set 4 | |
* | |
* Copies a BMP piece by piece, but also resizes it, just because. | |
*/ | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Given a single input string, write a function that produces all possible anagrams | |
* of a string and outputs them as an array. At first, don't worry about | |
* repeated strings. What time complexity is your solution? | |
* | |
* Extra credit: Deduplicate your return array without using uniq(). | |
*/ | |
/** | |
* example usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The company I work for creates custom acrylic cases based on customer's inputted dimensions. | |
// For fabrication our dimensions go down to the nearest 1/16th inch. | |
// International customers may use cm (or mm) and this is a program that will attempt to convert cm to inches | |
// down to the nearest 16th of an inch and display the result as a reduced fraction. | |
// 1 cm is equivalent to 0.39370 inches. | |
// EXAMPLE: 16.4 cm = 6 7/16 inches | |
// EXAMPLE: 10.5 cm = 4 2/16 or 4 1/8 inches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
/** | |
* | |
* Write, in a file called initials.c, a program that prompts a user for | |
* their name (using GetString to obtain their name as a string) and then | |
* outputs their initials in uppercase with no spaces or periods, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* whodunit.c | |
* | |
* Computer Science 50 | |
* Problem Set 4 | |
* | |
* Copies a BMP piece by piece, with slight variation. | |
*/ | |
#include <stdio.h> |
NewerOlder