Skip to content

Instantly share code, notes, and snippets.

View BhavikDhandhalya's full-sized avatar
😀
Busy

Bhavik Dhandhalya BhavikDhandhalya

😀
Busy
  • India
View GitHub Profile
@BhavikDhandhalya
BhavikDhandhalya / pytorch-theme.json
Created April 12, 2024 18:07
visual studio code pytorch theme settings
{
"workbench.colorTheme": "Default Light+",
"workbench.colorCustomizations": {
"editor.background": "#f1f1f1",
},
"editor.tokenColorCustomizations": {
"variables": "#000000",
"keywords": "#0086a4",
"comments": "#c1c1c1",
"functions": "#980000",
@BhavikDhandhalya
BhavikDhandhalya / competitive.go
Created April 30, 2021 10:15
Golang template for competitive programming
package main
import (
"bufio"
. "fmt"
"os"
"math"
)
var (
@BhavikDhandhalya
BhavikDhandhalya / Dockerfile
Created April 6, 2021 10:37
Dockerfile for my python applicaion
FROM python
RUN mkdir src
WORKDIR /src/
COPY test.py .
@BhavikDhandhalya
BhavikDhandhalya / test.py
Created April 6, 2021 10:31
python file that reads config.json file
f = open("foo/config.json", "r")
print(f.read())
@BhavikDhandhalya
BhavikDhandhalya / pod.yaml
Created April 6, 2021 10:25
Using ConfigMap in my python application
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mypod
image: test/map:1.0
command: ["python", "/src/test.py"]
imagePullPolicy: Never
@BhavikDhandhalya
BhavikDhandhalya / Black_Shapes.cpp
Created June 11, 2019 12:07
black shapes interview bit (using c++ lambda for recursive dfs)
int n;
int m;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int Solution::black(vector<string> &A) {
n = A.size();
if (n == 0) return 0;
m = A[0].length();
vector < vector < bool > > visited(n, vector < bool > (m, false));
@BhavikDhandhalya
BhavikDhandhalya / BST_inorder_preorder_postorder_iterative.cpp
Created June 3, 2019 15:38
Recursive and Iterative implementation of Preorder Inorder Postorder traversal of Binary Search Tree(BST)
/*
Sample Input
10
5 4 8 1 6 10 3 7 2 9
Sample Output
PreOrder Recursive :
5 4 1 3 2 8 6 7 10 9
PreOrder iterative :
5 4 1 3 2 8 6 7 10 9
@BhavikDhandhalya
BhavikDhandhalya / TarjanSCC.cpp
Last active May 26, 2019 10:31
Tarjan's strongly connected component algorithm
/*
Below code is function which returns number of strongly connected components.
https://www.youtube.com/watch?v=TyWtx7q2D7Y
https://www.tutorialspoint.com/Tarjan-s-Algorithm-for-Strongly-Connected-Components
*/
int id;
int ans;
@BhavikDhandhalya
BhavikDhandhalya / left_view_BST.cpp
Created May 21, 2019 13:24
Left View of Binary Search Tree [New approach]
/*
Problems:
https://practice.geeksforgeeks.org/problems/left-view-of-binary-tree/1
*/
/*
SAMPLE INPUT
1
8
5 4 7 1 2 8 9 10
@BhavikDhandhalya
BhavikDhandhalya / pollard_brent.py
Created November 25, 2018 08:01
Comparison: Pollard vs. Brent Factorization algorithms
"""
Bhavik Dhandhalya
BITS Pilani, ME Computer Science batch 2020
"""
from fractions import gcd
from random import randint
import time
def f(x, c, n):
return (x ** 2 + c) % n