Skip to content

Instantly share code, notes, and snippets.

@redpanda-ai
Last active September 17, 2023 20:03
Show Gist options
  • Save redpanda-ai/0c189909ed021dd86d6a4e2e9547682f to your computer and use it in GitHub Desktop.
Save redpanda-ai/0c189909ed021dd86d6a4e2e9547682f to your computer and use it in GitHub Desktop.
Sample Successful Installation of the ctci tool
❯ git clone https://github.com/redpanda-ai/ctci.git
Cloning into 'ctci'...
remote: Enumerating objects: 560, done.
remote: Counting objects: 100% (89/89), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 560 (delta 48), reused 37 (delta 27), pack-reused 471
Receiving objects: 100% (560/560), 132.24 KiB | 1.67 MiB/s, done.
Resolving deltas: 100% (282/282), done.
❯ cd ctci
❯ pipenv install
Creating a virtualenv for this project...
Pipfile: /home/andrewkey/gitprojects/ctci/Pipfile
Using /usr/bin/python3 (3.11.5) to create virtualenv...
⠙ Creating virtual environment...created virtual environment CPython3.11.5.final.0-64 in 126ms
creator CPython3Posix(dest=/home/andrewkey/.local/share/virtualenvs/ctci-2gcrk978, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/andrewkey/.local/share/virtualenv)
added seed packages: pip==23.2.1, setuptools==68.2.0, wheel==0.41.2
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Virtualenv location: /home/andrewkey/.local/share/virtualenvs/ctci-2gcrk978
Installing dependencies from Pipfile.lock (741f7a)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
❯ pipenv shell
Launching subshell in virtual environment...
❯ . /home/andrewkey/.local/share/virtualenvs/ctci-2gcrk978/bin/activate
❯ python problem_picker.py
Loading 180 questions from 16 files.
You will have 0 seconds to answer the question, good luck!
Title:
LRU Cache
Question:
Design and build a least recently used' cache, which evicts the least recently used item. The cache should map from keys to values (allowing you to insert and retrieve a value associated with a particular key) and be initialized with a max size. When it is full, it should evict the least recently used item.
Your question has been copied to your internal clipboard, you can now paste it into an editor.
The program selected Chapter 16 Question 25
╭─    ~/gitprojects/ctci  on   master ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✔  ctci-2gcrk978  ╱ base   at 12:59:10  ─╮
╰─
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment