DSA preparation using Leetcode and Notion

DSA preparation using Leetcode and Notion

Hi, there. If you're great at solving DSA problems and remembering the concepts and patterns long after solving such a problem, this post is not for you. If you keep forgetting the concepts and patterns used in a problem, if you have been unable to solve a question, you've previously solved, when you faced the same in a contest or interview, then keep reading.

We're going to use a well-known studying technique spaced repetition.


  • A Leetcode account (link)

  • A Notion account (link)

  • Ensure that python3 and pip are installed in the environment.


  1. Clone this repo: LC_Notion python branch

     git clone https://github.com/Azanul/LC_Notion.git
     git checkout python
  2. You'll find a file named testenv in the folder. Open it.

  3. We need to fill these three fields to get the script to work. Let's start with lc_username. Simply copy your Leetcode username and append it to the first row (after lc_username).

  4. Go to https://www.notion.so/my-integrations. Log in to your Notion account.

  5. You'll be on this screen now. Click on create a new integration.

  6. Fill out the form as shown below. You are free to put anything in the "Name" and "Logo" fields. Click on Submit.

  7. A new integration has been created by the name you entered. Click on it. I created it with the name Leetcode.

  8. Click on show under secrets then click on copy (or copy it yourself, who am I to judge).

  9. Now append the copied text in the 2nd row (after personel_notion_token ).

  10. Go to this link (LC Spaced Repetition Template).

  11. Click on Duplicate and choose the same Notion workspace you chose in step 7.

  12. The template has been cloned to your Notion workspace. Now just copy the text right after notion.so and before? and paste it into the 3rd row of our testenv file (right after personal_db_id ).

  13. Now rename the file testenv to test.env . Now you must have your env file something like this. Finally! we're all done with the setup.

Running the script

If you're using Linux/MacOS use run.sh and if you're on Windows use run.bat. Simply run the file in the terminal/command prompt as instructed below.

For Linux/MacOS.


For Windows


Check out the template you duplicated, Last 15 questions that you solved on Leetcode have been updated.

Comment down below if you have any questions or requests.


Did you find this article valuable?

Support Azanul Haque by becoming a sponsor. Any amount is appreciated!