Skip to content

Instantly share code, notes, and snippets.

@chrisdel101
chrisdel101 / lines.py
Created May 31, 2018 03:15
Lines from similarites
def lines(file1, file2):
result = set()
def getLinesList(file):
# storage array
fileList = []
# temp storage array
tempList = []
# if all lines have \n at the end
import cs50
# Pseudo
# - divide total by a coin amount
# - keep dividing it by increments of that coin, count each time
# - subtract from total each time, amount left undivided
# - move the amount left from coin to coin
def greedy():
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <xlocale.h>
@chrisdel101
chrisdel101 / dictionary.h
Created April 30, 2018 00:23
Implementing check()
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dictionary.h"
I mean redo the code entirely
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
// Copies a BMP file
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
@chrisdel101
chrisdel101 / helpers.c
Created March 4, 2018 17:32
Messy, as it's not the final draft
// Helper functions for music
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include "helpers.h"
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
// cleaned up with counter
int main(int argc, char *argv[]){
if(argc != 2) {
printf("Error on input");
exit(1);
}
string input = get_string("Input:");
printf("plaintext: %s\n", input);
printf("ciphertext: ");
There is a queue for the self-checkout tills at the supermarket. Your task is write a function to calculate the total time required for all the customers to check out!
The function has two input variables:
customers: an array (list in python) of positive integers representing the queue. Each integer represents a customer, and its value is the amount of time they require to check out.
n: a positive integer, the number of checkout tills.
The function should return an integer, the total time required.
EDIT: A lot of people have been confused in the comments. To try to prevent any more confusion: