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
""" | |
Implement an data structure that takes in a dictionary [doc_id] = doc_content | |
which contains a method search(word) and returns a list of document IDs containing the word. | |
Followup: update the data structure such that it also contains a method search_phrase(phrase) that | |
returns the document ids containing the phrase. | |
""" | |
from collections import defaultdict |
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
""" | |
You have one chocolate bar that consists of some chunks. Each chunk has its own sweetness given by the array sweetness. | |
You want to share the chocolate with your k friends so you start cutting the chocolate bar into k + 1 pieces using k cuts, each piece consists of some consecutive chunks. | |
Being generous, you will eat the piece with the minimum total sweetness and give the other pieces to your friends. | |
Find the maximum total sweetness of the piece you can get by cutting the chocolate bar optimally. | |
""" | |
def maximizeSweetness(self, sweetness: List[int], k: int) -> int: |
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
Delphix | |
Booking | |
Kayak | |
Expedia | |
NerdWallet | |
Venmo | |
GoDaddy | |
Grubhub | |
Turo | |
Atlassian |
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
class Solution { | |
public int canCompleteCircuit(int[] gas, int[] cost) { | |
int n = gas.length; | |
int total_tank = 0; | |
int curr_tank = 0; | |
int starting_station = 0; | |
for (int i = 0; i < n; ++i) { | |
total_tank += gas[i] - cost[i]; | |
curr_tank += gas[i] - cost[i]; |
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
def get_combi(s): | |
return get_combi_with_refixes([], s) | |
""" | |
The idea is to assume you have a calculated array of strings that you need | |
to append to. if its a ?, you "branch out" adding more to the array. When | |
suffix is empty, that means you have successfully recursed through the whole | |
string. | |
""" | |
def get_combi_with_prefixes(prefixes, suffix): |
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
import urllib | |
import os | |
country_codes = ['ad', | |
'ae', | |
'af', | |
'ag', | |
'ai', | |
'al', | |
'am', |
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
from botocore.vendored import requests | |
def lambda_handler(event, context): | |
API_ENDPOINT_URL = event.get('api_endpoint_url') | |
DATA = event.get('data') | |
S3_BUCKET = event.get('s3_bucket') | |
S3_FILE_OBJECT_DIR_KEY = event.get('s3_file_object_dir_key') | |
PROJECT_ID = event.get('project_id') | |
JOB_ID = event.get('job_id') | |
OCTOPUS_SERVER_URL = event.get('octopus_server_url') |
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
import * as firebase from 'firebase/app' | |
import 'firebase/auth' | |
import { | |
FIREBASE_APIKEY, | |
FIREBASE_APPID, | |
FIREBASE_AUTHDOMAIN, | |
FIREBASE_DATABASEURL, | |
FIREBASE_MEASUREMENTID, | |
FIREBASE_MESSAGINGSENDERID, | |
FIREBASE_PROJECTID, |
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
func (c *ContentServiceComponent) UpdateSourceRep(req respondAPI.UpdateSourceRepRequest, authSpec AuthenticationSpec) (*respondAPI.UpdateSourceRepResponse, error) { | |
GeneralLogger.Printf("Request Payload for /UpdateSourceRep:\n"+ | |
"{\n"+ | |
"\tSourceId: %v,\n"+ | |
"\tReputation: %v,\n"+ | |
"}", | |
req.SourceId, req.Reputation) | |
now := time.Now().UnixNano() |
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
func ProcessNode(node, spec) { | |
... | |
return ContentNodeWithDisplay{...} | |
} | |
type ProcessArgs { | |
node *ContentNode | |
spec ProcessNodeSpec | |
} |
NewerOlder