Vy has recently familiarized herself with the computer keyboard and is now tackling some Leetcode problems. However, she frequently struggles to recall the problems she has solved before. Consequently, she requires assistance from a management system.
This approach involves keeping track of several parameters related the learning and an experimental basic version of the Leitner system, enhanced by incorporating time-awareness (classic Leitner system). In other words, it utilizes distinct Leitner systems tailored for various time intervals. To reduce it the classic Leitner system, set the constant (in constants.py
) TRACKER_DEFAULT_INTERVAL
to a large value such as SECS_DAY(1000000)
.
The project is implemented in Python which is easily hackable by Leetcode users. It can be used for studying other subjects than solving Leetcode problems.
The Python implementation does not require any additional packages. However, to use the leetcode-scripts, it requires neovim (a text editor, you can change it to your favorite editor in leetcode-scripts/vy-config
) to edit the code and =fzf= (a fuzzy search) to quickly browser problems.
All commands can be skipped with ESC.
Relevant directories:
- Study results are stored in
subjects/sbj-leetcode/study/
- Added problems are stored in
subject/sbj-leetcode/item/item.json
- Parameters related to the learning are stored in
subject/sbj-leetcode/tracker/tracker.json
problem-lists.txt
contains problem titles and some tags. It is to simplify the process of adding a new problem.
I downloaded that file from some github repo long time ago that, unfortunately, I cannot remember where it comes from. You can change the problem-lists.txt
to your own problem lists.
Remove everything in the directory subjects/
to start the study anew.
In the leetcode-scripts
direction, run
Command | Description |
---|---|
vy-learn-leetcode | initializing the leetcode project by generating necessary directories |
vy-add | add a problem to solve from problem-lists.txt |
vy-add -i {problem_id} -n {name} -t {tags_separated_by_comma} | add a problem to solve by specifying name (required), id (optional), and tags (optional) (this problem is not required to be in problem-lists.txt |
vy-remove | remove a problem (search from the list of added problems) |
vy-remove -i {problem_id} | remove a problem by problem_id |
e.g., below is the following screenshot of vy-add
A study item (a Leetcode problem) has 3 states: (1) new (haven’t attempted), (2) studying (currently solving), and (3) studied (was attempted before, regardless we solved it, i.e., pass or fail). The transitions between these states are as follows.
vy-add
—[new]—>vy-start
—[studying]—>vy-complete
(regardless pass, i.e., we solved it by ourself like in an interview, or fail, i.e., we looked at the solution, asked someone)—[studied]vy-add
—[new]—>vy-start
—[studying]—>vy-cancel
—[new]- [studied]—>
vy-start
—[studying]—>vy-complete
/vy-cancel
—[studied] - [studied]—>
vy-review-xxx
—[studying]—>vy-complete
/vy-cancel
—[studied]
Command | Description |
---|---|
vy-start | select a problem to start coding with nvim (change to another editor in leetcode-scripts/vy-config ). The program automatically creates a python script with a unique name (based on the problem id) in subjects/sbj-leetcode/study , and opens it with a text editor (default is nvim ). If we start the same problem with vy-start , the same file is opened, so the program helps us manage the python scripts of all solved problems. |
vy-start -i {problem_id} | same as vy-start but with provided problem_id |
vy-end | complete a problem with result: pass (we solved it by ourself, like in an interview), fail (we looked at the solution, or we asked someone) |
vy-cancel | cancel solving a problem |
vy-note | select a problem to add a note (or retrieve previous note). It is similar to vy-start . A markdown file with a unique name (based on the problem id) is created in subjects/sbj-leetcode/study . |
vy-note -i {problem_id} | same as vy-note , but with a provided problem_id |
vy-view | view a previously solved solution without starting the problem |
vy-view -i {problem_id} | same as vy-view , but with a provided problem_id |
Below are screenshots of vy-start
. It first lists all tags with the number of problems in each tag (and in a state).
Then, we can choose a tag to list problems in that tag. We can list problems in all tags by pressing ESC.
Then, we can search for a problem in this list to start. The program will open a python script with a unique name for that problem. If the state of a problem is
_studying_
, it means we continue the problem we started before. Note that if the state of a problem is _studied_
, we do not show its state. Starting a _studied_
problem will open the script containing the solution that we coded before.
Command | Description |
---|---|
vy-list | list added problems |
vy-list-new | list added, but not attempted, problems |
vy-list-pass | list solved problems by the percentage of successfully solving the problem |
vy-list-studying | list pending problems |
vy-list-duration | list solved problems by time spent solving |
vy-list-recent | list solved problems by the most recent attempt |
vy-list-competency | list solved problems by based on how compentent the learner is |
e.g., below are screenshots of
vy-list
17/19
indicates that the problem was successfully solved 17 times out of 19 attempts.
vy-list-recent
Tag can be used to mark a problem as interesting, tricky, or note a specific trick/approach to the problem.
Command | Description |
---|---|
vy-add-tag -t {tags_separated_by_comma} | add tags to a problem |
vy-add-tag -t {tags_separated_by_comma} -i {problem_id} | add tags to a problem with problem_id |
vy-remove-tag | remove a tag from a problem |
vy-remove-tag -i {problem_id} | remove a tag from a problem with problem_id |
Command | Description |
---|---|
vy-suggest-competency | suggest a solved problem for reviews (based on the Leitner system). If the user decides to review the problem, the program runs vy-start . |
vy-suggest-duration | suggest a solved problem for reviews (based on the amount of time spent on the problem |
vy-suggest-pass | suggest a solved problem for reviews (based on the percentage of successfully solving the problem |
vy-suggest-recent | suggest a solved problem for reviews (based on how recent the problem is solved) |
Below are screenshots of vy-suggest-competency
. Like vy-start
, it first lists all tags.
Then, we can choose a tag to have a suggestion in that tag. We can consider all tags by pressing ESC. A random problem is suggested based on the criterion: competency, duration, pass, or recent.
There are 3 cases:
- If the suggested problem is too easy for us, we can choose to skip the suggestion, and request another suggestion
- If the suggested problem is interesting to us, we can choose to start the suggested problem. Its effect is the same as running
vy-start
on that problem. - We can quit the command. We can also do this by pressing ESC.
vy-list-competency
lists problems based on how competent the learner is about solving it. This competency is measured by the BOX property, shown as B:x. The large the BOX is, the higher the competency is, following the Leitner system. Note that the competency takes into the time since the last seeing the problem. Thus, it seems to be incorrect at first (as the model has not interacted with the learner a lot). For the model to correctly learn the level of competency, run vy-suggest-competency
and start solving problem that you are not confident; or skip the problem that you are confident. This is a way that the model interacts with the learner to learn about the level of competency.