This file contains hidden or 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
# 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 |
This file contains hidden or 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 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 |
This file contains hidden or 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 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.” |
This file contains hidden or 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
/** | |
* 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] | |
* |
This file contains hidden or 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
/** | |
* 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] |
This file contains hidden or 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 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 '[[]][]'. | |
* |
This file contains hidden or 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 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"; |