Skip to content

Instantly share code, notes, and snippets.

@selimslab
selimslab / decodeString.py
Last active October 26, 2020 07:29
String Algorithms
def decodeString(self, s):
"""
s = "3[a]2[bc]", return "aaabcbc".
s = "3[a2[c]]", return "accaccacc".
s = "2[abc]3[cd]ef", return "abcabccdcdcdef".
"""
stack = []; coeff = 0; ans = ''
for c in s:
func climbStairs(n int) int {
memo := map[int]int{
1:1,
2:2,
}
var climb func(n int) int
climb = func (n int) int {
_, ok := memo[n];
if !ok {
<style>
:root{
--main: hsl(230, 44%, 55%);
--secondary: hsl(230, 44%, 55%)
}
body{
background-color: var(--main)
}
html{
from collections import defaultdict
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
from fuzzywuzzy import process, fuzz
def match_by_fuzzy_string_search(
possible_matches: List[str], string_to_be_searched: str
) -> str:
scores = dict()
for candidate in possible_matches:
n = len(candidate.split())
n_grams = generate_ngrams(string_to_be_searched, n)
@selimslab
selimslab / sensor.c
Last active August 7, 2019 20:15
TSL-2561 light sensor library for Nordic nRF 51822
#include < stdio.h >
#include "boards.h"
#include "app_util_platform.h"
#include "app_uart.h"
#include "app_error.h"
#include "nrf_drv_twi.h"
#include "nrf_delay.h"
#include "main.h"
/* Define version of GCC. */