Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
arr="$@"
cool_strong=("${arr[@]:8:11}")
cute=("${arr[@]:20:4}")
all="I am $cool_strong and $cute"
echo $all
./arrays.bash awesome cool strong cute awesome #I am cool strong and cute
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:
// 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: ");
# 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 ->
@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"
// Copies a BMP file
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
I mean redo the code entirely
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
@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"
// 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>
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():