Skip to content

Instantly share code, notes, and snippets.

View vipul43's full-sized avatar
😇
BUSY IN ENGINEERING

vipul vipul43

😇
BUSY IN ENGINEERING
View GitHub Profile
@vipul43
vipul43 / hospital_structure.sql
Last active May 6, 2021 05:33
hospital database creation script (without data)
/*HOSPITAL MANAGEMENT SYSTEM*/
CREATE DATABASE IF NOT EXISTS `hospital`;
USE `hospital`;
--------------------------------------------------------
/*creating entities*/
--------------------------------------------------------
CREATE TABLE IF NOT EXISTS `patient` (
@vipul43
vipul43 / Word_Ladder_I.cpp
Created February 17, 2021 17:11
16th feb, 2021; favourite problem of the day; problem link: https://www.interviewbit.com/problems/word-ladder-i/
bool differByOneChar(string &a, string &b){
int diff = 0;
for(int i=0; i<a.size(); ++i){
if(a[i]!=b[i]) diff++;
if(diff>1) return false;
}
return diff==1;
}
int dfsHelper(unordered_map<string, vector<string>> &adj, string A, string B){
queue<string> s;
@vipul43
vipul43 / Word_Search_Board
Created February 15, 2021 18:05
15th feb, 2021; favourite problem of the day; problem link: https://www.interviewbit.com/problems/word-search-board/
#define deb(x) cout << #x << " " << x << endl;
vector<pair<int, int>> getDirs(pair<int, int> cur, int row, int col){
vector<pair<int, int>> dirs;
if(cur.first+1<row) dirs.push_back({cur.first+1, cur.second});
if(cur.first-1>=0) dirs.push_back({cur.first-1, cur.second});
if(cur.second+1<col) dirs.push_back({cur.first, cur.second+1});
if(cur.second-1>=0) dirs.push_back({cur.first, cur.second-1});
return dirs;
@vipul43
vipul43 / db_load_script.py
Created January 21, 2021 18:38
python script to load csv data into mysql database
import pandas as pd
import mysql.connector as msql
from mysql.connector import Error
import datetime
accountsData = pd.read_csv('/Users/vipul/Downloads/accounts_master.csv')
accountsData.drop(accountsData.columns[[7, 8]], axis = 1, inplace = True)
accountsData.dropna(subset = ["Account Name", "IP Domain", "SFDC Account ID"], inplace=True)
unravelData = pd.read_csv('/Users/vipul/Downloads/sir_unravel_v2.csv')
unravelData.drop_duplicates(subset ="OpenCX Buyer Id", keep = 'first', inplace = True)
@vipul43
vipul43 / fibonacci_logn.cpp
Created December 12, 2020 15:25
finding nth term of fibonacci(1, 1, 2, 3, ...) in O(logn) time complexity
#include<bits/stdc++.h>
#define MOD 1000000007
map<long long, long long> dp;
long long ans(long long n){
if(n<=2) {
dp[n]=1;
return dp[n];
}
if(dp[n]) return dp[n];
if(n%2==0){
@vipul43
vipul43 / colorData.json
Created August 29, 2020 13:36
color dataset for color classifier
{
"entries": [
{
"b": 155,
"g": 183,
"label": "green-ish",
"r": 81,
"uid": "EjbbUhVExBSZxtpKfcQ5qzT7jDW2"
},
{
// #include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <numeric>
#include <cmath>
//HEADING: STRING MATCHING//
//PROBLEM STATEMENT:
/*
FIND THE NUMBER OF OCCURENCES OF A SUBSTRING IN A GIVEN STRING.
NUMBER OF OCCURENCES ALSO INCLUDE OVERLAPPING SUBSTRINGS.
NUMBER OF OCCURENCES ALSO INCLUDE REPETIIONS.
ALGORITHM RETURNS THE NUMBER OF SUCH OCCURENCES.
*/
##HEADING: STRING MATCHING
#PROBLEM STATEMENT:
"""
FIND THE NUMBER OF OCCURENCES OF A SUBSTRING IN A GIVEN STRING.
NUMBER OF OCCURENCES ALSO INCLUDE OVERLAPPING SUBSTRINGS.
NUMBER OF OCCURENCES ALSO INCLUDE REPETIIONS.
ALGORITHM RETURNS THE NUMBER OF SUCH OCCURENCES.
"""
@vipul43
vipul43 / parallelopiped.cpp
Created July 21, 2020 20:46
ladderid_11 question
// #include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <numeric>
#include <cmath>