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
# https://leetcode.com/problems/path-sum-iii/ | |
# Given a binary tree and a number ‘S’, find all paths in the tree such that the | |
# sum of all the node values of each path equals ‘S’. Please note that the paths | |
# can start or end at any node but all paths must follow direction from parent to | |
# child (top to bottom). | |
# 1 | |
# /\ | |
# 7 9 |
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
# @param {String} s | |
# @return {Integer} | |
def length_of_longest_substring(s) | |
chars = s.split('') | |
longest = 0 | |
base = 0 | |
char_set = Set.new | |
(base...chars.length).each do |iter| |
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
package main | |
// Match accepts a pattern and a string. It will do a full string match base on | |
// the following rules: | |
// | |
// - A non-special character in a pattern matches only that character. | |
// - The special-character `.` in the pattern matches any single character. | |
// - The special-character `?` in the pattern does not match any character, but | |
// indicates the following character in the pattern can match zero or one times. | |
// - The special-character `*` in the pattern does not match any character, but |
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
package main | |
import ( | |
"context" | |
"log" | |
"time" | |
"cloud.google.com/go/pubsub" | |
"cloud.google.com/go/pubsub/pstest" | |
"google.golang.org/api/option" |
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
#/bin/bash | |
profiles=~/Library/Application\ Support/Firefox/Profiles | |
if ! [[ -d $profiles ]]; then | |
echo "Looks like firefox isn't installed" | |
exit 1 | |
fi | |
for dir in $(ls "$profiles"); do | |
[[ $dir != *default ]] && exit 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
// Requirements | |
// | |
// | |
// Read all orders from the paginated API. | |
// Any order without cookies can be fulfilled. | |
// Prioritize fulfilling orders with the highest amount of cookies. | |
// If orders have the same amount of cookies, prioritize the order with the lowest ID. | |
// If an order has an amount of cookies bigger than the remaining cookies, skip the order. | |
// | |
// |