Skip to content

Instantly share code, notes, and snippets.

View bigmate's full-sized avatar
🌴
On vacation

Bekmamat bigmate

🌴
On vacation
View GitHub Profile
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:
ring = Ring(n+1)
curr = head
@bigmate
bigmate / calc_steps.go
Created June 19, 2022 16:15
Calculate number of steps it takes to enter passcode on random (3x3) numpad
package main
import "fmt"
func calcSteps(passcode, numpad string) int {
steps := 0
pad := parseNumpad(numpad)
adj := adjacencyMap(pad)
for i := 1; i < len(passcode); i++ {
@bigmate
bigmate / rabbit.py
Last active September 8, 2021 09:29
Given n steps the rabbit has to jump to reach to the top and k representing number of steps the rabbit can jump at most, write a function that returns all possible combination of steps the rabbit can step up to reach the top
from typing import List
from collections import deque
class Stack:
def __init__(self):
self.stack = deque()
def push(self, el: int):
self.stack.append(el)
@bigmate
bigmate / config
Created May 17, 2021 09:40 — forked from pksunkara/config
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
[sendemail]
smtpencryption = tls
@bigmate
bigmate / main.go
Created January 8, 2021 21:19
Post about go-forms
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
func main() {
@bigmate
bigmate / validators.go
Created January 8, 2021 21:17
Post about go-forms
package main
import (
"errors"
"regexp"
"github.com/bigmate/go-forms"
"github.com/nicksnyder/go-i18n/v2/i18n"
)
@bigmate
bigmate / forms.go
Last active January 8, 2021 21:15
Post about go-forms
package main
import (
"github.com/bigmate/go-forms"
)
func UserCreateForm() forms.Form {
return forms.New(
forms.CharField("first_name", true, forms.Min(3), forms.Max(15)),
forms.CharField("username", true, forms.Within(8, 8)),
@bigmate
bigmate / docker-help.md
Created December 16, 2019 12:47 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info