Skip to content

Instantly share code, notes, and snippets.

View sharatsachin's full-sized avatar
😃
Focusing

Sharat Sachin sharatsachin

😃
Focusing
View GitHub Profile
@sharatsachin
sharatsachin / do_commits_in_past_leetcode.py
Created November 7, 2023 06:47
Take a folder containing your leetcode solutions and commit them in the past.
# print the list of all files in the leetcode directory
import os
import pathlib
import glob
import itertools
files = pathlib.Path("leetcode")
file_ext = ['cpp', 'py', 'postgresql']
new_folder = './leetcode-solutions'
@sharatsachin
sharatsachin / LPS.cpp
Last active January 10, 2019 17:52
Longest palindromic substring
#include <bits/stdc++.h>
using namespace std;
// function used to convert the given string of size 'n' into
// the auxiliary string of size '2n+1'
string convert(string str)
{
string nw = "#";
for (int i = 0; i < str.size(); ++i) {
nw += str.substr(i, 1) + "#";