Skip to content

Instantly share code, notes, and snippets.


Selim Ozturk selimslab

View GitHub Profile
selimslab /
Last active Jun 18, 2021 — forked from leoloobeek/
Download all gists of a user
import sys
from subprocess import call
import json
import os
import requests
def download_gists(gists: list):
for gist in gists:
call(["git", "clone", gist["git_pull_url"]])
selimslab /
Last active Feb 12, 2021
a simple blockchain in 100 lines
import time
import hashlib
import uuid
import random
from dataclasses import dataclass
from typing import List
class Node:
uid: str
selimslab /
Last active Feb 11, 2021
a search engine in 200 lines
import re
import math
import operator
import logging
from collections import defaultdict, Counter
import numpy as np
class Tokenizer:
def __init__(self, stop_words, ):
View minSteps.go
Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:
Copy All: You can copy all the characters present on the notepad (partial copy is not allowed).
Paste: You can paste the characters which are copied last time.
Given a number n. You have to get exactly n 'A' on the notepad by performing the minimum number of steps permitted. Output the minimum number of steps to get n 'A'.
Example 1:
View 0-structs.c
#include <stdio.h>
#include <stdlib.h>
#define STACK_MAX 256
typedef enum
} ObjectType;
View morse.go
func uniqueMorseRepresentations(words []string) int {
morse := []string{".-","-...","-.-.","-..",".","..-.",
tf := make(map[string]bool)
for _, word := range words {
rep := ""
for _, r := range word {
selimslab / postorder.go
Created Nov 15, 2020
n-ary tree traversal
View postorder.go
* Definition for a Node.
* type Node struct {
* Val int
* Children []*Node
* }
import "fmt"
View readme.txt
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
The same word in the dictionary may be reused multiple times in the segmentation.
You may assume the dictionary does not contain duplicate words.
Example 1:
Input: s = "leetcode", wordDict = ["leet", "code"]
Output: true
View maxSlidingWindow.go
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
Return the max sliding window.
Example 1:
Input: nums = [1,3,-1,-3,5,3,6,7], k = 3