ladderz/notebooks/rust/dsa.ipynb

80 lines
1.7 KiB
Text

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ladderz dsa usage\n",
"\n",
"Here are some examples of using the `dsa` (data structures and algorithms) module from `ladderz`.\n",
"\n",
"> This notebook uses [evcxr](https://github.com/evcxr/evcxr) for a Rust Jupyter Kernel. See [the evcxr_jupyter README.md](https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/README.md) for more info on how to run this notebook on your machine."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"vscode": {
"languageId": "rust"
}
},
"outputs": [],
"source": [
"// Uncomment the next line and comment the subsequent line if not running notebook from source\n",
":dep ladderz = { git = \"https://github.com/rzmk/ladderz\", branch = \"main\" }\n",
"// :dep ladderz = { path = \"../../ladderz\" }\n",
"\n",
"use ladderz::dsa;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 217. Contains Duplicate"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "rust"
}
},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dsa::contains_duplicate(vec![1, 3, 4, 2, 4])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Rust",
"language": "rust",
"name": "rust"
},
"language_info": {
"codemirror_mode": "rust",
"file_extension": ".rs",
"mimetype": "text/rust",
"name": "Rust",
"pygment_lexer": "rust",
"version": ""
}
},
"nbformat": 4,
"nbformat_minor": 2
}