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 / 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.
@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 / 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 / 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 / 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 / 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 / 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 / Custom Comparator.py
Created June 22, 2022 18:58
Custom comparator implementation for sorting array
import functools
item = [4, 5, 13, 1, 2, 7]
def cmp(a, b):
if a < b:
return -1
elif a == b:
return 0
@siddhantmedar
siddhantmedar / Prefix Tree.py
Created March 20, 2022 04:28
Implementation of Prefix Tree (Trie) in Python along with insert and search operations
class Trie:
def __init__(self):
self.children = {}
self.isEnd = False
def insert(self, word):
curr = self
for w in word:
if w not in curr.children:
curr.children[w] = Trie()
@siddhantmedar
siddhantmedar / Jupyter_Notebook_CMD_fix
Created November 30, 2019 17:10
Fix! Error while opening Jupyter Notebook from Windows Command Prompt
When an attempt is made to open Jupyter Notebook using Command Prompt, an error is displayed. The solution to this problem is to launch Jupyter Notebook either from Anaconda Command Prompt OR Anconda Navigator