Skip to content

Instantly share code, notes, and snippets.

View siddhantmedar's full-sized avatar
🎯
Focusing

Siddhant Medar siddhantmedar

🎯
Focusing
  • United States
View GitHub Profile
@siddhantmedar
siddhantmedar / heapq custom comparator.py
Created June 22, 2022 18:59
Custom Comparator for Objects - Heapq
import heapq
from collections import Counter
class Obj:
def __init__(self, a, b):
self.a = a
self.b = b
def __lt__(self, other):
@siddhantmedar
siddhantmedar / System Design.md
Created July 2, 2022 01:59 — 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?
@siddhantmedar
siddhantmedar / grokking_to_leetcode.md
Created July 7, 2022 08:02 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@siddhantmedar
siddhantmedar / Sudoku Solver.py
Created July 22, 2022 02:09
Python code for sudoku solver [Backtracking Problem]
def isSafe(i, j, num, n):
for k in range(n):
if board[i][k] == num or board[k][j] == num:
return False
sx, sy = (i // 3) * 3, (j // 3) * 3
for x in range(sx, sx + 3):
for y in range(sy, sy + 3):
if board[x][y] == num:
@siddhantmedar
siddhantmedar / Tarjans.py
Created July 25, 2022 05:26
Tarjan's Algorithm for finding SCC in graph
def dfs(graph, node):
global timer
visited.add(node)
timer += 1
disc[node] = low[node] = timer
inStack[node] = True
st.append(node)
@siddhantmedar
siddhantmedar / Union Find-Matrix.py
Created July 27, 2022 06:36
Union Find Template for Matrix Data Structure
class Solution:
def numIslands(self, mat: List[List[str]]) -> int:
def find(a):
if a != parent[a]:
parent[a] = find(parent[a])
return parent[a]
def union(x,y):
@siddhantmedar
siddhantmedar / llama-quantize_fix.txt
Last active December 30, 2024 20:56
RuntimeError: Unsloth: The file 'llama.cpp/llama-quantize' or 'llama.cpp/quantize' does not exist. But we expect this file to exist! Maybe the llama.cpp developers changed the name?
First, clone the llama.cpp repository and follow the steps below:
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
git checkout b3345
git submodule update --init --recursive
make clean
make all -j
git log -1
Credits to Zhangy-ly for this fix.