Skip to content

Instantly share code, notes, and snippets.

@leetcode-notes
leetcode-notes / A-umbrella.md
Created August 28, 2020 21:00 — forked from lubien/A-umbrella.md
Umbrella Challenge

Umbrella Challenge

Given a number of people N and an array of integers, each one representing the amount of people a type of umbrella can handle, output the minimum number of umbrellas needed to handle N people.

No umbrella could have left spaces. Which means if a umbrella can handle 2 people, there should be 2 people under it.

If there's no solution, return -1.

Examples

// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};
@leetcode-notes
leetcode-notes / gist:d8d0f08d58eda567edf2b1ef99dd73d3
Created July 20, 2020 00:29 — forked from alexkay/gist:1600725
Code Sprint 2 - Subsequence Weighting
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
struct Node {
int a;
long long w;
Node *prev;
#predicting the streaming kafka messages
consumer = KafkaConsumer('twitter-stream',bootstrap_servers=\['localhost:9092'])
print("Starting ML predictions.")
for message in consumer:
X_new_counts = count_vect.transform([message.value])
X_new_tfidf = tfidf_transformer.transform(X_new_counts)
predicted = load_model.predict(X_new_tfidf)
print(message.value+" => "+fetch_train_dataset(categories).target_names[predicted[0]])
.css-selector {
    background: linear-gradient(147deg, #6d2ff6, #6dac67);
    background-size: 400% 400%;
    -webkit-animation: AnimationName 11s ease infinite;
    -moz-animation: AnimationName 11s ease infinite;
    -o-animation: AnimationName 11s ease infinite;
    animation: AnimationName 11s ease infinite;
}
@-webkit-keyframes AnimationName {
    0%{background-position:9% 0%}
<?php
namespace App\Service\Pay;
/**
* TaiwanPay
*/
class TaiwanPay
{
/**
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from apiclient.discovery import build
def build_service(filename):
with open(filename) as f:
key = f.readline()
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
return build(YOUTUBE_API_SERVICE_NAME,
YOUTUBE_API_VERSION,
@leetcode-notes
leetcode-notes / System Design.md
Created June 28, 2020 22:58 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?