Skip to content

Instantly share code, notes, and snippets.

View mkstix6's full-sized avatar

Mark Stickling mkstix6

View GitHub Profile
@mkstix6
mkstix6 / cassidoo-20210517.ts
Created May 19, 2021 15:30
Cassidoo challenge #196 20210517
/**
* Given a list of people with their names and the
* time slots when they are available in a given
* week, and a meeting length, return the first
* meeting time available (if possible).
* Format the input however you’d like to receive it!
*/
// Define length of time slot is 1 hour.
const availableToken: string = "0";
@mkstix6
mkstix6 / cassidoo-20210426.js
Last active April 26, 2021 17:44
Cassidoo challenge #193 20210426
/**
* Given a string of brackets, return a rotation
* of those brackets that is balanced. The numbers
* of opening and closing brackets will always be
* equal, so [ or ][] won't be given as inputs.
*
* Example:
* $ rotateBrackets(']][][[')
* $ '[[]][]' // First rotation yields '[]][]['.Second one yields '[[]][]'.
*
@mkstix6
mkstix6 / cassidoo-20210419.js
Created April 21, 2021 11:27
Cassidoo challenge #192 20210419
/**
* This week’s question:
* Given an integer array, move all 0s to the
* end of it while maintaining the relative
* order of the non-zeroes.
* Bonus: do this without making a copy of the array!
*
* Example:
* $ moveZeroes([0,2,0,3,8])
* $ [2,3,8,0,0]
@mkstix6
mkstix6 / cassidoo-20210412.js
Last active April 21, 2021 11:27
Cassidoo challenge #191 20210412
/**
* This week’s question:
* Given an array of 0s and 1s that represent a garden,
* where 0 is a plot that hasn’t been planted on, and 1
* is a plot that has been planted on, return true if n
* plants can be planted without touching another plant.
*
* Example:
* garden = [1,0,0,0,1]
*
@mkstix6
mkstix6 / cassidoo-20210329.js
Created March 30, 2021 18:39
Cassidoo challenge 20210329
/**
* Given a string, return true if the string represents
* a valid number. A valid number can include integers,
* a ., -, or +.
*
* Examples of valid numbers:
* “7”, “0011”, “+3.14”, “4.”, “-.9”, “-123.456”, “-0.1”
*
* Examples of invalid numbers:
* “abc”, “1a”, “e8”, “--6”, “-+3”, “95x54e53.”
@mkstix6
mkstix6 / validTTTPosition.js
Created March 10, 2021 20:47
Rendezvous with Cassidoo #186 - Interview question of the week - validTTTPosition
const validTTTPosition = (boardInput) => {
// Assuming boardInput of form ["XOX", " X ", " "]
// Re-organise board chars; I'm comfy with arrays.
const boardChars = [...boardInput.join("")];
// Player char counts
const Xcount = boardChars.filter((char) => char === "X").length;
const Ocount = boardChars.filter((char) => char === "O").length;
// Mustn't have less Xs than Os; assume X goes first
if (Xcount < Ocount) return false;
// Mustn't have 2 more Xs than Os; assume we take turns
@mkstix6
mkstix6 / gource.sh
Last active June 3, 2016 17:34 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install