How to filter emails from GitHub in Gmail and flag them with labels.
The labels in this document are just examples.
Filter | Label |
---|
package concatenate_test | |
import ( | |
"strings" | |
"testing" | |
) | |
func Concatenate(texts []string) string { | |
s := "" | |
for _, value := range texts { |
class Solution: | |
def plusOne(self, digits: List[int]) -> List[int]: | |
for i in range(len(digits)-1, -1, -1): | |
if digits[i] == 9: | |
digits[i] = 0 | |
else: | |
digits[i] += 1 | |
return digits | |
return [1] + digits |
class Solution: | |
def spiralOrder(self, matrix: List[List[int]]) -> List[int]: | |
i, j = 0, 0 | |
left, right, down, up = False, True, False, False | |
n, m = len(matrix), len(matrix[0]) | |
res = [] | |
visited = set() | |
def is_wall(i, j): |
class Solution: | |
def minCostII(self, costs: List[List[int]]) -> int: | |
# Recursion or top-down approach | |
# state: at any given state returns the minimum cost of painting a house i | |
# with color k which is: costs[i][k] + minimum cost of painting a house i + 1 with not k | |
# state variables are: | |
# i house index |
class Solution: | |
def minCost(self, costs: List[List[int]]) -> int: | |
# recursion | |
# state is the current house we are painting with color c that has a cost + min of prev min | |
# state variables are i, c | |
# recurrence relation : dp(i, c) = cost[c] + min(dp(i + 1, c-1), dp(i + 1, c+1)) | |
# base case: i == len(costs) return 0 | |
# @lru_cache(None) | |
# def dp(i, c): |
class Solution: | |
def maxProfit(self, prices: List[int], fee: int) -> int: | |
# top-down solution | |
# holding_a_stock = 'HOLDING' | |
# not_holding_any_stock = 'NOT_HOLDING' | |
# @lru_cache(None) | |
# def dp(i, holding_status): | |
# if i == len(prices): | |
# return 0 |
class Solution: | |
def longestCommonSubsequence(self, text1: str, text2: str) -> int: | |
# top down approach: function dp | |
# state variables are (i, j) where i is index of text1 and j is index of text2 | |
# if both carachters are equal retrun 1 | |
# else choose the max between the two remaining | |
from functools import lru_cache | |
@lru_cache(maxsize=None) |
class Solution(object): | |
def myAtoi(self, s): | |
""" | |
:type s: str | |
:rtype: int | |
""" | |
splitted = s.split(' ') | |
for i in splitted: | |
if not i: | |
continue |
class Solution(object): | |
def findOrder(self, num_courses, prerequisites): | |
""" | |
:type numCourses: int | |
:type prerequisites: List[List[int]] | |
:rtype: List[int] | |
""" | |
# basically this is Kahn algorithm for topological sorting | |
# I like it because it depends on the indegree centrality of the node | |
degrees = collections.defaultdict(int) |