Skip to content

Instantly share code, notes, and snippets.

@ankurchaudhary627
Created June 2, 2020 18:23
Show Gist options
  • Save ankurchaudhary627/16ed3971ef974529815a2ba78acfd4ec to your computer and use it in GitHub Desktop.
Save ankurchaudhary627/16ed3971ef974529815a2ba78acfd4ec to your computer and use it in GitHub Desktop.
Code creates the basic folder structure divided into weeks for 30days leet code challenge.
basePath = '<YOUR-BASE-DIRECTORY-PATH>'
numberOfWeeks = 5
day = 1
completed=False
solutionFileName = 'solution.cpp'
monthName = 'June'
year = '2020'
for week in range(1,numberOfWeeks+1):
folderName = 'Week-{0}'.format(week)
folderPath = os.path.join(basePath,folderName)
os.mkdir(folderPath)
while day<=week*7:
subFolderName = '0{0}-{1}-{2}'.format(day,monthName,year) if day<10 else '{0}-{1}-{2}'.format(day,monthName,year)
subFolderNamePath = os.path.join(folderPath,subFolderName)
os.mkdir(subFolderNamePath)
open("{0}/{1}".format(subFolderNamePath,solutionFileName),'a').close()
day+=1
if day>30:
completed=True
break;
open("{0}/input.txt".format(folderPath),'a').close()
open("{0}/output.txt".format(folderPath),'a').close()
if completed:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment