Initial commit
This commit is contained in:
commit
df2431a87a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*stfolder*
|
16
.obsidian/app.json
vendored
Normal file
16
.obsidian/app.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"legacyEditor": false,
|
||||
"livePreview": false,
|
||||
"promptDelete": false,
|
||||
"showLineNumber": true,
|
||||
"spellcheck": true,
|
||||
"tabSize": 2,
|
||||
"vimMode": true,
|
||||
"foldHeading": true,
|
||||
"alwaysUpdateLinks": true,
|
||||
"showUnsupportedFiles": true,
|
||||
"attachmentFolderPath": "files",
|
||||
"defaultViewMode": "preview",
|
||||
"fileSortOrder": "byCreatedTime",
|
||||
"showFrontmatter": true
|
||||
}
|
16
.obsidian/app.sync-conflict-20220613-201420-XGSV5XE.json
vendored
Normal file
16
.obsidian/app.sync-conflict-20220613-201420-XGSV5XE.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"legacyEditor": false,
|
||||
"livePreview": false,
|
||||
"promptDelete": false,
|
||||
"showLineNumber": true,
|
||||
"spellcheck": true,
|
||||
"tabSize": 2,
|
||||
"vimMode": true,
|
||||
"foldHeading": true,
|
||||
"alwaysUpdateLinks": true,
|
||||
"showUnsupportedFiles": true,
|
||||
"attachmentFolderPath": "_files",
|
||||
"defaultViewMode": "preview",
|
||||
"fileSortOrder": "alphabetical",
|
||||
"showFrontmatter": true
|
||||
}
|
12
.obsidian/appearance.json
vendored
Normal file
12
.obsidian/appearance.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"theme": "obsidian",
|
||||
"translucency": true,
|
||||
"cssTheme": "Atom",
|
||||
"interfaceFontFamily": "IBM Plex Sans",
|
||||
"textFontFamily": "IBM Plex Mono,monospace",
|
||||
"monospaceFontFamily": "IBM Plex Mono",
|
||||
"baseFontSize": 18,
|
||||
"enabledCssSnippets": [
|
||||
"expander"
|
||||
]
|
||||
}
|
12
.obsidian/appearance.sync-conflict-20220613-201420-XGSV5XE.json
vendored
Normal file
12
.obsidian/appearance.sync-conflict-20220613-201420-XGSV5XE.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"theme": "obsidian",
|
||||
"translucency": true,
|
||||
"cssTheme": "Atom",
|
||||
"interfaceFontFamily": "IBM Plex Sans",
|
||||
"textFontFamily": "IBM Plex Mono",
|
||||
"monospaceFontFamily": "IBM Plex Mono",
|
||||
"baseFontSize": 19,
|
||||
"enabledCssSnippets": [
|
||||
"expander"
|
||||
]
|
||||
}
|
12
.obsidian/appearance.sync-conflict-20220613-201554-XGSV5XE.json
vendored
Normal file
12
.obsidian/appearance.sync-conflict-20220613-201554-XGSV5XE.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"theme": "obsidian",
|
||||
"translucency": true,
|
||||
"cssTheme": "Atom",
|
||||
"interfaceFontFamily": "IBM Plex Sans",
|
||||
"textFontFamily": "IBM Plex Mono,monospace",
|
||||
"monospaceFontFamily": "IBM Plex Mono",
|
||||
"baseFontSize": 18,
|
||||
"enabledCssSnippets": [
|
||||
"expander"
|
||||
]
|
||||
}
|
4
.obsidian/community-plugins.json
vendored
Normal file
4
.obsidian/community-plugins.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
"mrj-text-expand",
|
||||
"obsidian-git"
|
||||
]
|
20
.obsidian/core-plugins.json
vendored
Normal file
20
.obsidian/core-plugins.json
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
"file-explorer",
|
||||
"global-search",
|
||||
"switcher",
|
||||
"graph",
|
||||
"backlink",
|
||||
"outgoing-link",
|
||||
"tag-pane",
|
||||
"page-preview",
|
||||
"templates",
|
||||
"note-composer",
|
||||
"command-palette",
|
||||
"editor-status",
|
||||
"starred",
|
||||
"markdown-importer",
|
||||
"outline",
|
||||
"word-count",
|
||||
"open-with-default-app",
|
||||
"file-recovery"
|
||||
]
|
37
.obsidian/graph.json
vendored
Normal file
37
.obsidian/graph.json
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"collapse-filter": false,
|
||||
"search": "",
|
||||
"showTags": false,
|
||||
"showAttachments": false,
|
||||
"hideUnresolved": false,
|
||||
"showOrphans": false,
|
||||
"collapse-color-groups": false,
|
||||
"colorGroups": [
|
||||
{
|
||||
"query": "tag:#CS_analysis",
|
||||
"color": {
|
||||
"a": 1,
|
||||
"rgb": 14725458
|
||||
}
|
||||
},
|
||||
{
|
||||
"query": "tag:#leetcode",
|
||||
"color": {
|
||||
"a": 1,
|
||||
"rgb": 1673572
|
||||
}
|
||||
}
|
||||
],
|
||||
"collapse-display": false,
|
||||
"showArrow": true,
|
||||
"textFadeMultiplier": 0,
|
||||
"nodeSizeMultiplier": 1,
|
||||
"lineSizeMultiplier": 1,
|
||||
"collapse-forces": false,
|
||||
"centerStrength": 0.518713248970312,
|
||||
"repelStrength": 10,
|
||||
"linkStrength": 1,
|
||||
"linkDistance": 250,
|
||||
"scale": 1.166549028490861,
|
||||
"close": true
|
||||
}
|
66
.obsidian/hotkeys.json
vendored
Normal file
66
.obsidian/hotkeys.json
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"editor:delete-paragraph": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "D"
|
||||
}
|
||||
],
|
||||
"editor:insert-link": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "K"
|
||||
}
|
||||
],
|
||||
"editor:open-search": [],
|
||||
"editor:toggle-bold": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "B"
|
||||
}
|
||||
],
|
||||
"editor:toggle-italics": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "I"
|
||||
}
|
||||
],
|
||||
"switcher:open": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "O"
|
||||
}
|
||||
],
|
||||
"command-palette:open": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "P"
|
||||
}
|
||||
],
|
||||
"mrj-text-expand:editor-expand-all": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "E"
|
||||
}
|
||||
]
|
||||
}
|
11
.obsidian/plugins/mrj-text-expand/data.json
vendored
Normal file
11
.obsidian/plugins/mrj-text-expand/data.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"autoExpand": false,
|
||||
"defaultTemplate": "- $link",
|
||||
"delay": 100,
|
||||
"excludeCurrent": true,
|
||||
"lineEnding": "",
|
||||
"prefixes": {
|
||||
"header": "^",
|
||||
"footer": ">"
|
||||
}
|
||||
}
|
871
.obsidian/plugins/mrj-text-expand/main.js
vendored
Normal file
871
.obsidian/plugins/mrj-text-expand/main.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
.obsidian/plugins/mrj-text-expand/manifest.json
vendored
Normal file
9
.obsidian/plugins/mrj-text-expand/manifest.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"id": "mrj-text-expand",
|
||||
"name": "Text expand",
|
||||
"version": "0.10.8",
|
||||
"description": "Search and paste/transclude links to located files.",
|
||||
"isDesktopOnly": false,
|
||||
"author": "MrJackphil",
|
||||
"authorUrl": "https://mrjackphil.com"
|
||||
}
|
24
.obsidian/plugins/obsidian-git/data.json
vendored
Normal file
24
.obsidian/plugins/obsidian-git/data.json
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"commitMessage": "vault backup: {{date}}",
|
||||
"autoCommitMessage": "vault backup: {{date}}",
|
||||
"commitDateFormat": "YYYY-MM-DD HH:mm:ss",
|
||||
"autoSaveInterval": 0,
|
||||
"autoPushInterval": 0,
|
||||
"autoPullInterval": 0,
|
||||
"autoPullOnBoot": false,
|
||||
"disablePush": false,
|
||||
"pullBeforePush": true,
|
||||
"disablePopups": false,
|
||||
"listChangedFilesInMessageBody": false,
|
||||
"showStatusBar": true,
|
||||
"updateSubmodules": false,
|
||||
"syncMethod": "merge",
|
||||
"gitPath": "",
|
||||
"customMessageOnAutoBackup": false,
|
||||
"autoBackupAfterFileChange": false,
|
||||
"treeStructure": false,
|
||||
"refreshSourceControl": true,
|
||||
"basePath": "",
|
||||
"differentIntervalCommitAndPush": false,
|
||||
"changedFilesInStatusBar": false
|
||||
}
|
14915
.obsidian/plugins/obsidian-git/main.js
vendored
Normal file
14915
.obsidian/plugins/obsidian-git/main.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
.obsidian/plugins/obsidian-git/manifest.json
vendored
Normal file
8
.obsidian/plugins/obsidian-git/manifest.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"id": "obsidian-git",
|
||||
"name": "Obsidian Git",
|
||||
"description": "Backup your vault with git.",
|
||||
"isDesktopOnly": true,
|
||||
"js": "main.js",
|
||||
"version": "1.26.1"
|
||||
}
|
413
.obsidian/plugins/obsidian-git/styles.css
vendored
Normal file
413
.obsidian/plugins/obsidian-git/styles.css
vendored
Normal file
|
@ -0,0 +1,413 @@
|
|||
@keyframes loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.loading > svg {
|
||||
animation: 2s linear infinite loading;
|
||||
transform-origin: 50% 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.obsidian-git-center {
|
||||
margin: auto;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.tooltip.mod-left {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.tooltip.mod-right {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.obsidian-git-shortcuts {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.diff-err {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.diff-err-sign {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
|
||||
display: none;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
|
||||
text-align: left;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
|
||||
background-color: var(--background-primary);
|
||||
border-bottom: 1px solid var(--interactive-accent);
|
||||
font-family: var(--font-monospace);
|
||||
height: 35px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||
font-size: 14px;
|
||||
margin-left: auto;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
|
||||
border: 1px solid #b4e2b4;
|
||||
border-radius: 5px 0 0 5px;
|
||||
color: #399839;
|
||||
padding: 2px;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
|
||||
border: 1px solid #e9aeae;
|
||||
border-radius: 0 5px 5px 0;
|
||||
color: #c33;
|
||||
margin-left: 1px;
|
||||
padding: 2px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
|
||||
-webkit-box-pack: end;
|
||||
-ms-flex-pack: end;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
justify-content: flex-end;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
|
||||
background-color: #c8e1ff;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
|
||||
margin: 0 4px 0 0;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
|
||||
border-collapse: collapse;
|
||||
font-family: Menlo, Consolas, monospace;
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
|
||||
width: 100%;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
|
||||
display: inline-block;
|
||||
margin-bottom: -8px;
|
||||
margin-right: -4px;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 50%;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
|
||||
padding: 0 8em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||
display: inline-block;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||
padding: 0 4.5em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
vertical-align: middle;
|
||||
white-space: pre;
|
||||
width: 100%;
|
||||
}
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
del {
|
||||
background-color: #ffb6ba;
|
||||
}
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
del {
|
||||
background-color: #8d232881;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
|
||||
border-radius: 0.2em;
|
||||
display: inline-block;
|
||||
margin-top: -1px;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
ins {
|
||||
background-color: #97f295;
|
||||
text-align: left;
|
||||
}
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
ins {
|
||||
background-color: #1d921996;
|
||||
text-align: left;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num1 {
|
||||
float: left;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num1,
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
padding: 0 0.5em;
|
||||
text-overflow: ellipsis;
|
||||
width: 3.5em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||
float: right;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
width: 7.5em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding: 0 0.5em;
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
text-overflow: ellipsis;
|
||||
width: 4em;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||
direction: rtl;
|
||||
}
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||
background-color: #fee8e9;
|
||||
border-color: #e9aeae;
|
||||
}
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||
background-color: #dfd;
|
||||
border-color: #b4e2b4;
|
||||
}
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||
background-color: #521b1d83;
|
||||
border-color: #691d1d73;
|
||||
}
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||
background-color: rgba(30, 71, 30, 0.5);
|
||||
border-color: #13501381;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-info {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-del.d2h-change {
|
||||
background-color: #fdf2d0;
|
||||
}
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-del.d2h-change {
|
||||
background-color: #55492480;
|
||||
}
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-ins.d2h-change {
|
||||
background-color: #ded;
|
||||
}
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-ins.d2h-change {
|
||||
background-color: rgba(37, 78, 37, 0.418);
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
|
||||
color: #3572b0;
|
||||
text-decoration: none;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-list-wrapper
|
||||
a:visited {
|
||||
color: #3572b0;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
|
||||
text-align: left;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
|
||||
font-weight: 700;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
text-align: left;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
|
||||
display: block;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
|
||||
border-bottom: 1px solid var(--background-modifier-border);
|
||||
margin: 0;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
|
||||
fill: currentColor;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
|
||||
color: #c33;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-added {
|
||||
color: #399839;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
|
||||
color: #d0b44c;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
|
||||
color: #3572b0;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
|
||||
background-color: var(--background-primary);
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 10px;
|
||||
margin-left: 5px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
|
||||
border: 2px solid #c33;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
|
||||
border: 1px solid #399839;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
|
||||
border: 1px solid #d0b44c;
|
||||
}
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
|
||||
border: 1px solid #3572b0;
|
||||
}
|
3
.obsidian/snippets/expander.css
vendored
Normal file
3
.obsidian/snippets/expander.css
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.language-expander {
|
||||
display: none;
|
||||
}
|
19
.obsidian/starred.json
vendored
Normal file
19
.obsidian/starred.json
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"items": [
|
||||
{
|
||||
"type": "file",
|
||||
"title": "Index",
|
||||
"path": "Index.md"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"title": "CS-index",
|
||||
"path": "CS notes/CS-index.md"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"title": "Wiki-Index",
|
||||
"path": "Wiki/Wiki-Index.md"
|
||||
}
|
||||
]
|
||||
}
|
3
.obsidian/templates.json
vendored
Normal file
3
.obsidian/templates.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"folder": "_templates"
|
||||
}
|
472
.obsidian/themes/Atom.css
vendored
Normal file
472
.obsidian/themes/Atom.css
vendored
Normal file
|
@ -0,0 +1,472 @@
|
|||
.theme-dark {
|
||||
--background-primary: #272b34;
|
||||
--background-primary-alt: #20242b;
|
||||
--background-secondary: #20242b;
|
||||
--background-secondary-alt: #1a1e24;
|
||||
--background-accent: #000;
|
||||
--background-modifier-border: #424958;
|
||||
--background-modifier-form-field: rgba(0, 0, 0, 0.3);
|
||||
--background-modifier-form-field-highlighted: rgba(0, 0, 0, 0.22);
|
||||
--background-modifier-box-shadow: rgba(0, 0, 0, 0.3);
|
||||
--background-modifier-success: #539126;
|
||||
--background-modifier-error: #3d0000;
|
||||
--background-modifier-error-rgb: 61, 0, 0;
|
||||
--background-modifier-error-hover: #470000;
|
||||
--background-modifier-cover: rgba(0, 0, 0, 0.6);
|
||||
--text-accent: #61afef;
|
||||
--text-accent-hover: #69bafd;
|
||||
--text-normal: #dcddde;
|
||||
--text-muted: #888;
|
||||
--text-faint: rgb(81, 86, 99);
|
||||
--text-error: #e16d76;
|
||||
--text-error-hover: #c9626a;
|
||||
--text-highlight-bg: rgba(255, 255, 0, 0.4);
|
||||
--text-selection: rgba(0, 122, 255, 0.2);
|
||||
--text-on-accent: #dcddde;
|
||||
--interactive-normal: #20242b;
|
||||
--interactive-hover: #353b47;
|
||||
--interactive-accent: #4c78cc;
|
||||
--interactive-accent-rgb: 76, 120, 204;
|
||||
--interactive-accent-hover: #5082df;
|
||||
--scrollbar-active-thumb-bg: rgba(255, 255, 255, 0.2);
|
||||
--scrollbar-bg: rgba(255, 255, 255, 0.05);
|
||||
--scrollbar-thumb-bg: rgba(255, 255, 255, 0.1);
|
||||
--panel-border-color: #18191e;
|
||||
--gray-1: #5C6370;
|
||||
--gray-2: #abb2bf;
|
||||
--red: #e06c75;
|
||||
--orange: #d19a66;
|
||||
--green: #98c379;
|
||||
--aqua: #56b6c2;
|
||||
--purple: #c678dd;
|
||||
--blue: #61afef;
|
||||
--yellow: #e5c07b;
|
||||
}
|
||||
|
||||
.theme-light {
|
||||
--background-primary: #fafafa;
|
||||
--background-primary-alt: #eaeaeb;
|
||||
--background-secondary: #eaeaeb;
|
||||
--background-secondary-alt: #dbdbdc;
|
||||
--background-accent: #fff;
|
||||
--background-modifier-border: #dbdbdc;
|
||||
--background-modifier-form-field: #fff;
|
||||
--background-modifier-form-field-highlighted: #fff;
|
||||
--background-modifier-box-shadow: rgba(0, 0, 0, 0.1);
|
||||
--background-modifier-success: #A4E7C3;
|
||||
--background-modifier-error: #e68787;
|
||||
--background-modifier-error-rgb: 230, 135, 135;
|
||||
--background-modifier-error-hover: #FF9494;
|
||||
--background-modifier-cover: rgba(0, 0, 0, 0.8);
|
||||
--text-accent: #1592ff;
|
||||
--text-accent-hover: #2d9dff;
|
||||
--text-normal: #383a42;
|
||||
--text-muted: #8e8e90;
|
||||
--text-faint: #999999;
|
||||
--text-error: #e75545;
|
||||
--text-error-hover: #f86959;
|
||||
--text-highlight-bg: rgba(255, 255, 0, 0.4);
|
||||
--text-selection: rgba(0, 122, 255, 0.15);
|
||||
--text-on-accent: #f2f2f2;
|
||||
--interactive-normal: #eaeaeb;
|
||||
--interactive-hover: #dbdbdc;
|
||||
--interactive-accent-rgb: 21, 146, 255;
|
||||
--interactive-accent: #5871ef;
|
||||
--interactive-accent-hover: #445bd1;
|
||||
--scrollbar-active-thumb-bg: rgba(0, 0, 0, 0.2);
|
||||
--scrollbar-bg: rgba(0, 0, 0, 0.05);
|
||||
--scrollbar-thumb-bg: rgba(0, 0, 0, 0.1);
|
||||
--panel-border-color: #dbdbdc;
|
||||
--gray-1: #383a42;
|
||||
--gray-2: #383a42;
|
||||
--red: #e75545;
|
||||
--green: #4ea24c;
|
||||
--blue: #3d74f6;
|
||||
--purple: #a625a4;
|
||||
--aqua: #0084bc;
|
||||
--yellow: #e35649;
|
||||
--orange: #986800;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: auto;
|
||||
}
|
||||
|
||||
.titlebar {
|
||||
background-color: var(--background-secondary-alt);
|
||||
}
|
||||
|
||||
.titlebar-inner {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background-color: var(--background-secondary-alt);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.tooltip:not(.mod-right):not(.mod-left):not(.mod-top) .tooltip-arrow {
|
||||
border-bottom-color: var(--background-secondary-alt) !important;
|
||||
}
|
||||
|
||||
.mod-right .tooltip-arrow {
|
||||
border-right-color: var(--background-secondary-alt) !important;
|
||||
}
|
||||
|
||||
.mod-left .tooltip-arrow {
|
||||
border-left-color: var(--background-secondary-alt) !important;
|
||||
}
|
||||
|
||||
.mod-top .tooltip-arrow {
|
||||
border-top-color: var(--background-secondary-alt) !important;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
cursor: pointer;
|
||||
background-image: url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234c78cc%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E);
|
||||
}
|
||||
|
||||
.dropdown:hover {
|
||||
background-color: var(--background-modifier-form-field);
|
||||
}
|
||||
|
||||
.search-result-file-title {
|
||||
color: var(--blue);
|
||||
}
|
||||
|
||||
li {
|
||||
padding-top: 0.5px;
|
||||
padding-bottom: 0.5px;
|
||||
}
|
||||
|
||||
a.tag, a.tag:hover {
|
||||
color: var(--yellow);
|
||||
background-color: var(--background-primary-alt);
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.markdown-preview-view .task-list-item-checkbox {
|
||||
-webkit-appearance: none;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid var(--text-muted);
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
width: 1.3em;
|
||||
height: 1.3em;
|
||||
margin: 0;
|
||||
filter: none;
|
||||
outline: none;
|
||||
margin-right: 4px;
|
||||
margin-bottom: 2px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.markdown-preview-view .task-list-item-checkbox:checked {
|
||||
border: none;
|
||||
background-color: var(--interactive-accent);
|
||||
}
|
||||
|
||||
.markdown-preview-view .task-list-item-checkbox:checked::before {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
left: 2px;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
bottom: 2px;
|
||||
-webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 14 14\'%3E%3Cpolygon points=\'5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039\'%3E%3C/polygon%3E%3C/svg%3E');
|
||||
}
|
||||
|
||||
.markdown-preview-view .task-list-item.is-checked a {
|
||||
filter: saturate(0.8) brightness(0.7);
|
||||
}
|
||||
|
||||
.cm-formatting-task {
|
||||
font-family: var(--font-monospace);
|
||||
}
|
||||
|
||||
.nav-file, .nav-folder {
|
||||
padding: 1px 2px;
|
||||
}
|
||||
|
||||
.nav-file-title, .nav-folder-title {
|
||||
width: 100%;
|
||||
cursor: default;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
flex-direction: row;
|
||||
--text-normal: var(--text-muted);
|
||||
}
|
||||
|
||||
body:not(.is-grabbing) .nav-file .nav-file-title:hover:not(.is-active), body:not(.is-grabbing) .nav-folder .nav-folder-title:hover:not(.is-active) {
|
||||
--background-secondary-alt: transparent;
|
||||
}
|
||||
|
||||
.nav-file .is-active {
|
||||
--background-secondary-alt: var(--interactive-accent);
|
||||
--text-normal: #ffffff;
|
||||
}
|
||||
|
||||
.nav-file-title-content, .nav-folder-title-content {
|
||||
text-indent: 0;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.markdown-preview-view.is-readable-line-width .markdown-preview-section, .markdown-source-view.is-readable-line-width .CodeMirror {
|
||||
max-width: 900px !important;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 20px 0;
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
body {
|
||||
--font-monospace: 'Fira Code', 'Source Code Pro', monospace;
|
||||
}
|
||||
|
||||
mjx-container[jax='CHTML'] {
|
||||
text-align: left;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.math-block {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
.cm-s-obsidian pre.HyperMD-codeblock, .cm-s-obsidian span.cm-inline-code, .cm-s-obsidian span.cm-math:not(.cm-formatting-math-begin):not(.cm-formatting-math-end), .markdown-preview-view code {
|
||||
/* fix `` tag color */
|
||||
color: #98c379;
|
||||
}
|
||||
|
||||
.cm-s-obsidian span.cm-inline-code, .cm-s-obsidian span.cm-math, .cm-s-obsidian span.hmd-fold-math-placeholder {
|
||||
/* fix tag size */
|
||||
font-weight: 100;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.markdown-preview-view code {
|
||||
vertical-align: 0;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.markdown-preview-section:not(:first-child) h1, .markdown-preview-section:not(:first-child) h2, .markdown-preview-section:not(:first-child) h3, .markdown-preview-section:not(:first-child) h4, .markdown-preview-section:not(:first-child) h5, .markdown-preview-section:not(:first-child) h6 {
|
||||
margin-top: 40px !important;
|
||||
}
|
||||
|
||||
.markdown-preview-section h1, .markdown-preview-section h2, .markdown-preview-section h3, .markdown-preview-section h4, .markdown-preview-section h5, .markdown-preview-section h6 {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, strong, b, .view-header-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.workspace>.workspace-split>.workspace-leaf:first-of-type:last-of-type .view-header {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.status-bar, .side-dock.mod-right, .side-dock.mod-left {
|
||||
border-color: var(--panel-border-color);
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
--bar-vertical-padding: 4px;
|
||||
--bar-height: calc(22px + (var(--bar-vertical-padding) * 2));
|
||||
line-height: 20px;
|
||||
padding: 0 20px;
|
||||
height: var(--bar-height);
|
||||
max-height: var(--bar-height);
|
||||
min-height: var(--bar-height);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.status-bar-item {
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.status-bar-item>* {
|
||||
padding-top: var(--bar-vertical-padding) !important;
|
||||
padding-bottom: var(--bar-vertical-padding) !important;
|
||||
}
|
||||
|
||||
.side-dock-plugin-panel-inner {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
a, .markdown-preview-view .internal-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover, .markdown-preview-view .internal-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.theme-dark :not(pre)>code[class*='language-'], .theme-dark pre[class*='language-'] {
|
||||
background: var(--background-primary-alt);
|
||||
}
|
||||
|
||||
.theme-light :not(pre)>code[class*='language-'], .theme-light pre[class*='language-'] {
|
||||
background: var(--background-primary);
|
||||
box-shadow: inset 0 0 0 1px var(--background-primary-alt);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.markdown-embed:not(.hover-popover .markdown-embed), .file-embed {
|
||||
margin: 0;
|
||||
border-radius: 4px;
|
||||
margin: 0 !important;
|
||||
margin-inline-start: 30px !important;
|
||||
margin-inline-end: 30px !important;
|
||||
}
|
||||
|
||||
.markdown-embed {
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-left-width: 5px;
|
||||
}
|
||||
|
||||
.markdown-embed .markdown-preview-view {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.markdown-embed-link, .file-embed-link {
|
||||
left: 8px;
|
||||
right: unset;
|
||||
}
|
||||
|
||||
.theme-light .token.operator, .theme-light .token.entity, .theme-light .token.url, .theme-light .language-css .token.string, .theme-light .style .token.string {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Source: https://github.com/AGMStudio/prism-theme-one-dark */
|
||||
|
||||
code[class*='language-'], pre[class*='language-'] {
|
||||
text-align: left !important;
|
||||
white-space: pre !important;
|
||||
word-spacing: normal !important;
|
||||
word-break: normal !important;
|
||||
word-wrap: normal !important;
|
||||
line-height: 1.5 !important;
|
||||
-moz-tab-size: 4 !important;
|
||||
-o-tab-size: 4 !important;
|
||||
tab-size: 4 !important;
|
||||
-webkit-hyphens: none !important;
|
||||
-moz-hyphens: none !important;
|
||||
-ms-hyphens: none !important;
|
||||
hyphens: none !important;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
|
||||
pre[class*='language-'] {
|
||||
padding: 1em !important;
|
||||
margin: .5em 0 !important;
|
||||
overflow: auto !important;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
|
||||
:not(pre)>code[class*='language-'] {
|
||||
padding: .1em !important;
|
||||
border-radius: .3em !important;
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
.token.comment, .token.prolog, .token.doctype, .token.cdata {
|
||||
color: var(--gray-1) !important;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: var(--gray-2) !important;
|
||||
}
|
||||
|
||||
.token.selector, .token.tag {
|
||||
color: var(--red) !important;
|
||||
}
|
||||
|
||||
.token.property, .token.boolean, .token.number, .token.constant, .token.symbol, .token.attr-name, .token.deleted {
|
||||
color: var(--orange) !important;
|
||||
}
|
||||
|
||||
.token.string, .token.char, .token.attr-value, .token.builtin, .token.inserted {
|
||||
color: var(--green) !important;
|
||||
}
|
||||
|
||||
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
|
||||
color: var(--aqua) !important;
|
||||
}
|
||||
|
||||
.token.atrule, .token.keyword {
|
||||
color: var(--purple) !important;
|
||||
}
|
||||
|
||||
.token.function, .token.macro.property {
|
||||
color: var(--blue) !important;
|
||||
}
|
||||
|
||||
.token.class-name {
|
||||
color: var(--yellow) !important;
|
||||
}
|
||||
|
||||
.token.regex, .token.important, .token.variable {
|
||||
color: var(--purple) !important;
|
||||
}
|
||||
|
||||
.token.important, .token.bold {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.token.italic {
|
||||
font-style: italic !important;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help !important;
|
||||
}
|
||||
|
||||
pre.line-numbers {
|
||||
position: relative !important;
|
||||
padding-left: 3.8em !important;
|
||||
counter-reset: linenumber !important;
|
||||
}
|
||||
|
||||
pre.line-numbers>code {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.line-numbers .line-numbers-rows {
|
||||
position: absolute !important;
|
||||
pointer-events: none !important;
|
||||
top: 0 !important;
|
||||
font-size: 100% !important;
|
||||
left: -3.8em !important;
|
||||
width: 3em !important;
|
||||
/* works for line-numbers below 1000 lines */
|
||||
letter-spacing: -1px !important;
|
||||
border-right: 0 !important;
|
||||
-webkit-user-select: none !important;
|
||||
-moz-user-select: none !important;
|
||||
-ms-user-select: none !important;
|
||||
user-select: none !important;
|
||||
}
|
||||
|
||||
.line-numbers-rows>span {
|
||||
pointer-events: none !important;
|
||||
display: block !important;
|
||||
counter-increment: linenumber !important;
|
||||
}
|
||||
|
||||
.line-numbers-rows>span:before {
|
||||
content: counter(linenumber) !important;
|
||||
color: var(--syntax-gray-1) !important;
|
||||
display: block !important;
|
||||
padding-right: 0.8em !important;
|
||||
text-align: right !important;
|
||||
}
|
159
.obsidian/workspace
vendored
Normal file
159
.obsidian/workspace
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
{
|
||||
"main": {
|
||||
"id": "9856b59c373440ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "cf977333cff98c94",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md",
|
||||
"mode": "preview",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
},
|
||||
"left": {
|
||||
"id": "654e26088317eda6",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "7a26546a3eef59fe",
|
||||
"type": "tabs",
|
||||
"dimension": 79.95991983967936,
|
||||
"children": [
|
||||
{
|
||||
"id": "9ca42282f81f27a8",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "b06d39b00e327dc3",
|
||||
"type": "tabs",
|
||||
"dimension": 20.04008016032064,
|
||||
"children": [
|
||||
{
|
||||
"id": "9fd87fc5ad3e86ee",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "starred",
|
||||
"state": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "18d35bef74f2720b",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "142873fcfcd0f687",
|
||||
"type": "tabs",
|
||||
"dimension": 40.3807615230461,
|
||||
"children": [
|
||||
{
|
||||
"id": "9c3fdcfa76b34713",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md",
|
||||
"collapseAll": true,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
"showSearch": false,
|
||||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "7b7f58052ceefca4",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e20d98be4c26fe37",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "tag",
|
||||
"state": {
|
||||
"sortOrder": "frequency",
|
||||
"useHierarchy": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "8d7c07d8147a8fab",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "34f8b139a3c9a1fc",
|
||||
"type": "tabs",
|
||||
"dimension": 59.6192384769539,
|
||||
"children": [
|
||||
{
|
||||
"id": "bcccacca989eec17",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "tag:#algorithm tag:#CS_analysis -tag:#template_remove_me ",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"active": "cf977333cff98c94",
|
||||
"lastOpenFiles": [
|
||||
"CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md",
|
||||
"Untitled.md",
|
||||
"CS notes/pages/Two pointers approach.md",
|
||||
"CS notes/CS-index.md",
|
||||
"CS notes/pages/cpp_std_multiset.md",
|
||||
"CS notes/pages/Leetcode Linked-List-Cycle.md",
|
||||
"CS notes/pages/Floyd's Cycle Finding Algorithm.md",
|
||||
"CS notes/pages/Binary Search Algorithm.md",
|
||||
"CS notes/pages/Leetcode Valid-Anagram.md",
|
||||
"CS notes/pages/Leetcode First-Unique-Character-In-a-String.md"
|
||||
]
|
||||
}
|
195
.obsidian/workspace.sync-conflict-20220613-201420-XGSV5XE
vendored
Normal file
195
.obsidian/workspace.sync-conflict-20220613-201420-XGSV5XE
vendored
Normal file
|
@ -0,0 +1,195 @@
|
|||
{
|
||||
"main": {
|
||||
"id": "9856b59c373440ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "7f1e0d32474d7f56",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Binary Search Algorithm.md",
|
||||
"mode": "preview",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
},
|
||||
"left": {
|
||||
"id": "4df80c244df89992",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "05fd175d18f726b6",
|
||||
"type": "tabs",
|
||||
"dimension": 51.903807615230455,
|
||||
"children": [
|
||||
{
|
||||
"id": "1c165a5cf2b9c326",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "3b4f0233e4d2e914",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "starred",
|
||||
"state": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2a4494dde1da5a18",
|
||||
"type": "tabs",
|
||||
"dimension": 48.09619238476954,
|
||||
"children": [
|
||||
{
|
||||
"id": "903409388dafd248",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "tag:#vector OR tag:#vector_2d OR tag:#binary_search",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 353
|
||||
},
|
||||
"right": {
|
||||
"id": "04ea9e39cc69c7f6",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "ae88bff2fa365bea",
|
||||
"type": "tabs",
|
||||
"dimension": 42.384769539078164,
|
||||
"children": [
|
||||
{
|
||||
"id": "4010cf71e69497ee",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Binary Search Algorithm.md"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2779adef8530c5c4",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "tag",
|
||||
"state": {
|
||||
"sortOrder": "frequency",
|
||||
"useHierarchy": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e64d81c7b14c0ddd",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "localgraph",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Binary Search Algorithm.md",
|
||||
"options": {
|
||||
"collapse-filter": true,
|
||||
"search": "",
|
||||
"localJumps": 1,
|
||||
"localBacklinks": true,
|
||||
"localForelinks": true,
|
||||
"localInterlinks": true,
|
||||
"showTags": true,
|
||||
"showAttachments": false,
|
||||
"hideUnresolved": false,
|
||||
"collapse-color-groups": true,
|
||||
"colorGroups": [],
|
||||
"collapse-display": false,
|
||||
"showArrow": false,
|
||||
"textFadeMultiplier": 0,
|
||||
"nodeSizeMultiplier": 1,
|
||||
"lineSizeMultiplier": 1,
|
||||
"collapse-forces": false,
|
||||
"centerStrength": 0.518713248970312,
|
||||
"repelStrength": 10,
|
||||
"linkStrength": 1,
|
||||
"linkDistance": 250,
|
||||
"scale": 0.8220621549603881,
|
||||
"close": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 2
|
||||
},
|
||||
{
|
||||
"id": "4239da40b67cb6ed",
|
||||
"type": "tabs",
|
||||
"dimension": 57.615230460921836,
|
||||
"children": [
|
||||
{
|
||||
"id": "79e6bf126ce52f00",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Binary Search Algorithm.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
"showSearch": false,
|
||||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "dc83579d04e04264",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Binary Search Algorithm.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 377
|
||||
},
|
||||
"active": "7f1e0d32474d7f56",
|
||||
"lastOpenFiles": [
|
||||
"CS notes/pages/Binary Search Algorithm.md",
|
||||
"CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"CS notes/pages/Leetcode Two-Sum.md",
|
||||
"CS notes/pages/Leetcode Merge-Sorted-Array.md",
|
||||
"CS notes/pages/Leetcode Valid-Sodoku.md",
|
||||
"CS notes/pages/Leetcode Reshape-The-Matrix.md",
|
||||
"CS notes/pages/Leetcode Pascal's-Triangle.md",
|
||||
"CS notes/pages/Leetcode Maxinum-subarray.md",
|
||||
"CS notes/pages/Kadane's Algorithm.md",
|
||||
"CS notes/pages/cpp_std_sort.md"
|
||||
]
|
||||
}
|
144
.obsidian/workspace.sync-conflict-20220613-201534-XGSV5XE
vendored
Normal file
144
.obsidian/workspace.sync-conflict-20220613-201534-XGSV5XE
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
"main": {
|
||||
"id": "9856b59c373440ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "cf977333cff98c94",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"mode": "preview",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
},
|
||||
"left": {
|
||||
"id": "5329f01bb60987ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "5001f5b0eaee0fca",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "5fa03533ef732fec",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e411da988293aefa",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "5d57f48390900b7a",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "starred",
|
||||
"state": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "ba0f7d08d7e94f7f",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "5d0ad059ef998d06",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "aff91c6763515ca9",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
"showSearch": false,
|
||||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9ba06f2c00787519",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1b4868ca42df8428",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "tag",
|
||||
"state": {
|
||||
"sortOrder": "frequency",
|
||||
"useHierarchy": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "32594260a2fa00d9",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "CS notes/pages/Leetcode Search-a-2D-Matrix.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300,
|
||||
"collapsed": true
|
||||
},
|
||||
"active": "cf977333cff98c94",
|
||||
"lastOpenFiles": [
|
||||
"CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"CS notes/pages/Binary Search Algorithm.md",
|
||||
"CS notes/CS-index.md",
|
||||
"CS notes/pages/Leetcode Reshape-The-Matrix.md",
|
||||
"Index.md",
|
||||
"Wiki/Wiki-Index.md",
|
||||
"Wiki/Learnings.md",
|
||||
"Wiki/Minecraft.md",
|
||||
"Wiki/Software Index.md",
|
||||
"CS notes/pages/Leetcode Pascal's-Triangle.md"
|
||||
]
|
||||
}
|
150
.obsidian/workspace.sync-conflict-20220613-201644-XGSV5XE
vendored
Normal file
150
.obsidian/workspace.sync-conflict-20220613-201644-XGSV5XE
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
{
|
||||
"main": {
|
||||
"id": "9856b59c373440ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "cf977333cff98c94",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "CS notes/CS-index.md",
|
||||
"mode": "preview",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
},
|
||||
"left": {
|
||||
"id": "5329f01bb60987ec",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "5001f5b0eaee0fca",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "5fa03533ef732fec",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "5d57f48390900b7a",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "starred",
|
||||
"state": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "d596f0decc360186",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "e411da988293aefa",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "tag:#algorithm tag:#CS_analysis -tag:#template_remove_me ",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "ba0f7d08d7e94f7f",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "5d0ad059ef998d06",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "aff91c6763515ca9",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "CS notes/CS-index.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
"showSearch": false,
|
||||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9ba06f2c00787519",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "CS notes/CS-index.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1b4868ca42df8428",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "tag",
|
||||
"state": {
|
||||
"sortOrder": "frequency",
|
||||
"useHierarchy": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "32594260a2fa00d9",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "CS notes/CS-index.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300,
|
||||
"collapsed": true
|
||||
},
|
||||
"active": "cf977333cff98c94",
|
||||
"lastOpenFiles": [
|
||||
"CS notes/CS-index.md",
|
||||
"CS notes/pages/Leetcode Search-a-2D-Matrix.md",
|
||||
"CS notes/pages/Binary Search Algorithm.md",
|
||||
"CS notes/pages/Leetcode Reshape-The-Matrix.md",
|
||||
"Index.md",
|
||||
"Wiki/Wiki-Index.md",
|
||||
"Wiki/Learnings.md",
|
||||
"Wiki/Minecraft.md",
|
||||
"Wiki/Software Index.md",
|
||||
"CS notes/pages/Leetcode Pascal's-Triangle.md"
|
||||
]
|
||||
}
|
128
CS notes/CS-index.md
Normal file
128
CS notes/CS-index.md
Normal file
|
@ -0,0 +1,128 @@
|
|||
```
|
||||
__
|
||||
_____ _____ ____ ____ / /____ _____
|
||||
/ ___/ / ___/ / __ \/ __ \/ __/ _ \/ ___/
|
||||
/ /__ (__ ) / / / / /_/ / /_/ __(__ )
|
||||
\___/ /____/ /_/ /_/\____/\__/\___/____/
|
||||
|
||||
```
|
||||
|
||||
# CS notes
|
||||
|
||||
This is where I store notes about CS
|
||||
|
||||
___
|
||||
## Websites
|
||||
|
||||
#### [leetcode.com](https://leetcode.com)
|
||||
|
||||
```expander
|
||||
tag:#leetcode
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
- [[Leetcode Best-Time-To-Buy-And-Sell-Stock]]
|
||||
- [[Leetcode First-Unique-Character-In-a-String]]
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Linked-List-Cycle]]
|
||||
- [[Leetcode Maxinum-subarray]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Merge-Two-Sorted-Lists]]
|
||||
- [[Leetcode Pascal's-Triangle]]
|
||||
- [[Leetcode Ransom-Note]]
|
||||
- [[Leetcode Reshape-The-Matrix]]
|
||||
- [[Leetcode Search-a-2D-Matrix]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
- [[Leetcode Valid-Anagram]]
|
||||
- [[Leetcode Valid-Sodoku]]
|
||||
|
||||
|
||||
|
||||
#### [hackerearth.com](https://www.hackerearth.com/)
|
||||
|
||||
```expander
|
||||
tag:#hackerearch
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
___
|
||||
|
||||
### Data Structure
|
||||
#### Coding problems
|
||||
```expander
|
||||
tag:#DS tag:#coding_problem -tag:#template_remove_me
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
- [[Leetcode Best-Time-To-Buy-And-Sell-Stock]]
|
||||
- [[Leetcode First-Unique-Character-In-a-String]]
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Linked-List-Cycle]]
|
||||
- [[Leetcode Maxinum-subarray]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Merge-Two-Sorted-Lists]]
|
||||
- [[Leetcode Pascal's-Triangle]]
|
||||
- [[Leetcode Ransom-Note]]
|
||||
- [[Leetcode Reshape-The-Matrix]]
|
||||
- [[Leetcode Search-a-2D-Matrix]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
- [[Leetcode Valid-Anagram]]
|
||||
- [[Leetcode Valid-Sodoku]]
|
||||
|
||||
|
||||
|
||||
#### Analysis
|
||||
```expander
|
||||
tag:#DS tag:#CS_analysis -tag:#template_remove_me
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[cpp_std_multiset]]
|
||||
- [[cpp_std_unordered_map]]
|
||||
|
||||
|
||||
|
||||
___
|
||||
### Algorithm
|
||||
#### Coding problems
|
||||
```expander
|
||||
tag:#algorithm tag:#coding_problem -tag:#template_remove_me
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
- [[Leetcode Best-Time-To-Buy-And-Sell-Stock]]
|
||||
- [[Leetcode First-Unique-Character-In-a-String]]
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Linked-List-Cycle]]
|
||||
- [[Leetcode Maxinum-subarray]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Merge-Two-Sorted-Lists]]
|
||||
- [[Leetcode Pascal's-Triangle]]
|
||||
- [[Leetcode Ransom-Note]]
|
||||
- [[Leetcode Search-a-2D-Matrix]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
- [[Leetcode Valid-Anagram]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### Analysis
|
||||
|
||||
```expander
|
||||
tag:#algorithm tag:#CS_analysis -tag:#template_remove_me
|
||||
- [[$filename]]
|
||||
```
|
||||
|
||||
- [[Binary Search Algorithm]]
|
||||
- [[cpp_std_sort]]
|
||||
- [[Floyd's Cycle Finding Algorithm]]
|
||||
- [[Kadane's Algorithm]]
|
||||
- [[Two pointers approach]]
|
||||
|
||||
|
||||
|
79
CS notes/pages/Binary Search Algorithm.md
Normal file
79
CS notes/pages/Binary Search Algorithm.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
# Binary Search Algorithm
|
||||
|
||||
#### 2022-06-13 15:46
|
||||
|
||||
___
|
||||
##### Algorithms:
|
||||
#algorithm #binary_search
|
||||
##### Data structures:
|
||||
#array #vector #set #multiset
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#binary_search -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Search-a-2D-Matrix]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [g4g for manual implementation](https://www.geeksforgeeks.org/binary-search/)
|
||||
- [cppreference, find](https://en.cppreference.com/w/cpp/container/set/find)
|
||||
___
|
||||
|
||||
### How to implement Binary search?
|
||||
|
||||
#### a: Use cpp's library
|
||||
Use cpp's set's [find](https://en.cppreference.com/w/cpp/container/set/find)
|
||||
or [equal_range](https://en.cppreference.com/w/cpp/container/multiset/equal_range)
|
||||
|
||||
#### b: Manual
|
||||
1. Use a while loop:
|
||||
[[Leetcode Search-a-2D-Matrix#Solution]]
|
||||
|
||||
2. Use recursion:
|
||||
from g4g:
|
||||
```cpp
|
||||
// C++ program to implement recursive Binary Search
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
// A recursive binary search function. It returns
|
||||
// location of x in given array arr[l..r] is present,
|
||||
// otherwise -1
|
||||
int binarySearch(int arr[], int l, int r, int x) {
|
||||
if (r >= l) {
|
||||
int mid = l + (r - l) / 2;
|
||||
|
||||
// If the element is present at the middle
|
||||
// itself
|
||||
if (arr[mid] == x)
|
||||
return mid;
|
||||
|
||||
// If element is smaller than mid, then
|
||||
// it can only be present in left subarray
|
||||
if (arr[mid] > x)
|
||||
return binarySearch(arr, l, mid - 1, x);
|
||||
|
||||
// Else the element can only be present
|
||||
// in right subarray
|
||||
return binarySearch(arr, mid + 1, r, x);
|
||||
}
|
||||
|
||||
// We reach here when element is not
|
||||
// present in array
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int arr[] = {2, 3, 4, 10, 40};
|
||||
int x = 10;
|
||||
int n = sizeof(arr) / sizeof(arr[0]);
|
||||
int result = binarySearch(arr, 0, n - 1, x);
|
||||
(result == -1) ? cout << "Element is not present in array"
|
||||
: cout << "Element is present at index " << result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
184
CS notes/pages/Floyd's Cycle Finding Algorithm.md
Normal file
184
CS notes/pages/Floyd's Cycle Finding Algorithm.md
Normal file
|
@ -0,0 +1,184 @@
|
|||
# Floyd's Cycle Finding Algorithm
|
||||
|
||||
#### 2022-06-14 22:10
|
||||
|
||||
___
|
||||
##### Algorithms:
|
||||
#algorithm #Floyd_s_cycle_finding_algorithm
|
||||
##### Data structures:
|
||||
#linked_list
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#Floyd_s_cycle_finding_algorithm -tag:#template_remove_me
|
||||
```
|
||||
|
||||
|
||||
##### Links:
|
||||
- [g4g](https://www.geeksforgeeks.org/floyds-cycle-finding-algorithm/)
|
||||
___
|
||||
|
||||
### What is Floyd's Cycle Finding Algorithm?
|
||||
[Floyd’s cycle finding algorithm](https://www.geeksforgeeks.org/detect-loop-in-a-linked-list/) or Hare-Tortoise algorithm is a **pointer algorithm** that uses only **two pointers**, moving through the sequence at different speeds.
|
||||
|
||||
It uses two pointers one moving twice as fast as the other one. The faster one is called the faster pointer and the other one is called the slow pointer.
|
||||
|
||||
### How does it work?
|
||||
|
||||
#### Part 1. **Verify** if there is a loop
|
||||
While traversing the linked list one of these things will occur-
|
||||
|
||||
- The Fast pointer may reach the end (NULL) this shows that there is no loop n the linked list.
|
||||
- The Fast pointer again **catches the slow pointer at some** time therefore a loop exists in the linked list.
|
||||
|
||||
**Pseudo-code:**
|
||||
|
||||
- Initialize two-pointers and start traversing the linked list.
|
||||
- Move the slow pointer by one position.
|
||||
- Move the fast pointer by **two** positions.
|
||||
- If both pointers meet at some point then a loop exists and if the fast pointer meets the end position then no loop exists.
|
||||
#### Part 2. **Locating the start** of the loop
|
||||
|
||||
Let us consider an example:
|
||||
|
||||
![Why floyd algorithm work](https://media.geeksforgeeks.org/wp-content/uploads/20220105124053/6-300x139.jpg)
|
||||
|
||||
- Let,
|
||||
|
||||
> **X =** Distance between the head(starting) to the loop starting point.
|
||||
>
|
||||
> **Y =** Distance between the loop starting point and the **first meeting point** of both the pointers.
|
||||
>
|
||||
> **C =** The distance of **the loop**
|
||||
|
||||
- So before both the pointer meets-
|
||||
|
||||
> The slow pointer has traveled **X + Y + s * C** distance, where s is any positive constant number.
|
||||
>
|
||||
> The fast pointer has traveled **X + Y + f * C** distance, where f is any positive constant number.
|
||||
|
||||
- Since the fast pointer is moving twice as fast as the slow pointer, we can say that the fast pointer covered twice the distance the slow pointer covered. Therefore-
|
||||
|
||||
> X + Y + f * C = 2 * (X + Y + s * C)
|
||||
>
|
||||
> X + Y = f * C – 2 * s * C
|
||||
>
|
||||
> We can say that,
|
||||
>
|
||||
> f * C – 2 * s * C = (some integer) * C
|
||||
>
|
||||
> = K * C
|
||||
>
|
||||
> Thus,
|
||||
>
|
||||
> X + Y = K * C **– ( 1 )**
|
||||
>
|
||||
> X = K * C – Y **– ( 2 )**
|
||||
>
|
||||
> Where K is some positive constant.
|
||||
|
||||
- Now if ==reset the slow pointer to the head==(starting position) and move both fast and slow pointer ==by one unit at a time==, one can observe from 1st and 2nd equation that **both of them will meet** after traveling X distance at the starting of the loop because after resetting the slow pointer and moving it X distance, at the same time from loop meeting point the fast pointer will also travel K * C – Y distance(because it already has traveled Y distance).
|
||||
- Because X = K * C - Y, while fast pointer was at Y from start of loop, running X will place it at the start of loop, meeting the slow pointer.
|
||||
|
||||
**Pseudo-code**
|
||||
- Place slow pointer at the head.
|
||||
- Move one step at a time until they met.
|
||||
- The start of the loop is where they met
|
||||
|
||||
#### Example
|
||||
```cpp
|
||||
// C++ program to implement
|
||||
// the above approach
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
class Node {
|
||||
public:
|
||||
int data;
|
||||
Node *next;
|
||||
|
||||
Node(int data) {
|
||||
this->data = data;
|
||||
next = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
// initialize a new head
|
||||
// for the linked list
|
||||
Node *head = NULL;
|
||||
class Linkedlist {
|
||||
public:
|
||||
// insert new value at the start
|
||||
void insert(int value) {
|
||||
Node *newNode = new Node(value);
|
||||
if (head == NULL)
|
||||
head = newNode;
|
||||
else {
|
||||
newNode->next = head;
|
||||
head = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
// detect if there is a loop
|
||||
// in the linked list
|
||||
Node *detectLoop() {
|
||||
Node *slowPointer = head, *fastPointer = head;
|
||||
|
||||
while (slowPointer != NULL && fastPointer != NULL &&
|
||||
fastPointer->next != NULL) {
|
||||
slowPointer = slowPointer->next;
|
||||
fastPointer = fastPointer->next->next;
|
||||
if (slowPointer == fastPointer)
|
||||
break;
|
||||
}
|
||||
|
||||
// if no loop exists
|
||||
if (slowPointer != fastPointer)
|
||||
return NULL;
|
||||
|
||||
// reset slow pointer to head
|
||||
// and traverse again
|
||||
slowPointer = head;
|
||||
while (slowPointer != fastPointer) {
|
||||
slowPointer = slowPointer->next;
|
||||
fastPointer = fastPointer->next;
|
||||
}
|
||||
|
||||
return slowPointer;
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
Linkedlist l1;
|
||||
// inserting new values
|
||||
l1.insert(10);
|
||||
l1.insert(20);
|
||||
l1.insert(30);
|
||||
l1.insert(40);
|
||||
l1.insert(50);
|
||||
|
||||
// adding a loop for the sake
|
||||
// of this example
|
||||
Node *temp = head;
|
||||
while (temp->next != NULL)
|
||||
temp = temp->next;
|
||||
// loop added;
|
||||
temp->next = head;
|
||||
|
||||
Node *loopStart = l1.detectLoop();
|
||||
if (loopStart == NULL)
|
||||
cout << "Loop does not exists" << endl;
|
||||
else {
|
||||
cout << "Loop does exists and starts from " << loopStart->data << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
### When to use?
|
||||
|
||||
This algorithm is used ==to find a loop in a linked list==, Also it ==can locate where the loop starts.==
|
||||
|
||||
It takes O(n) time complexity, O(1)space complexity.
|
41
CS notes/pages/Kadane's Algorithm.md
Normal file
41
CS notes/pages/Kadane's Algorithm.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Kadane's Algorithm
|
||||
|
||||
#### 2022-06-09
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#array
|
||||
##### Algorithms:
|
||||
#algorithm #Kadane_s_algorithm
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Time complexity:
|
||||
O(n)
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#Kadane_s_algorithm -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Best-Time-To-Buy-And-Sell-Stock]]
|
||||
- [[Leetcode Maxinum-subarray]]
|
||||
|
||||
|
||||
|
||||
##### Resources:
|
||||
- [Explainer article](https://medium.com/@rsinghal757/kadanes-algorithm-dynamic-programming-how-and-why-does-it-work-3fd8849ed73d)
|
||||
|
||||
---
|
||||
### What is Kadane's Algorithm?
|
||||
|
||||
It's a kind of dynamic programming. You calculate A[n] by calculating A[n - 1], which makes it O(n)
|
||||
|
||||
==local_maximum at index i is the maximum of (A[i] and the sum of A[i] and local_maximum at index i-1).==
|
||||
|
||||
> Because of the way this algorithm uses optimal substructures (the maximum subarray ending at each position is calculated in a simple way from a related but smaller and overlapping subproblem: the maximum subarray ending at the previous position) this algorithm can be viewed as a simple example of dynamic programming. Kadane’s algorithm is able to find the maximum sum of a contiguous subarray in an array with a runtime of **_O(n)_**.
|
||||
|
||||
### When to use it?
|
||||
|
||||
According my analyze [[Leetcode Best-Time-To-Buy-And-Sell-Stock#Thoughts| here]], we should use it when these conditions are met:
|
||||
- You want to find the value of the highest peak or lowest valley
|
||||
- The direction you search is mono-directional
|
||||
- The current value can be obtained from or, is related to the value before this one.
|
124
CS notes/pages/Leetcode Best-Time-To-Buy-And-Sell-Stock.md
Normal file
124
CS notes/pages/Leetcode Best-Time-To-Buy-And-Sell-Stock.md
Normal file
|
@ -0,0 +1,124 @@
|
|||
# Leetcode Best-Time-To-Buy-And-Sell-Stock
|
||||
|
||||
#### 2022-06-11
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #array
|
||||
##### Algorithms:
|
||||
#algorithm #Kadane_s_algorithm
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#Kadane_s_algorithm
|
||||
```
|
||||
|
||||
- [[Kadane's Algorithm]]
|
||||
- [[Leetcode Maxinum-subarray]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
|
||||
- [Kadane's Algo solution](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/solution/554875)
|
||||
|
||||
___
|
||||
### Problem
|
||||
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
|
||||
|
||||
You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock.
|
||||
|
||||
Return _the maximum profit you can achieve from this transaction_. If you cannot achieve any profit, return `0`.
|
||||
|
||||
#### Examples
|
||||
Example 1:
|
||||
|
||||
```
|
||||
Input: prices = [7,1,5,3,6,4]
|
||||
Output: 5
|
||||
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
|
||||
Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.
|
||||
|
||||
```
|
||||
|
||||
Example 2:
|
||||
|
||||
```
|
||||
Input: prices = [7,6,4,3,1]
|
||||
Output: 0
|
||||
Explanation: In this case, no transactions are done and the max profit = 0.
|
||||
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
- 1 <= prices.length <= 105
|
||||
- 0 <= prices[i] <= 104
|
||||
|
||||
### Thoughts
|
||||
|
||||
Firstly I thought of brute forcing, which is O(n * (n-1))
|
||||
Then, I came up with dynamic programming, but this is still not so optimized
|
||||
Lastly, from [here](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/solution/554875) I know We can use Kadane's algo.
|
||||
|
||||
> [!tip]
|
||||
> In Kadane's algorithm:
|
||||
> - buyprice = min(buyprice, price[i]) // Achieve best min price
|
||||
> - profit = max(profit, price[i] - buyprice) // find best profit **==so far==**
|
||||
|
||||
To explain that, in each iteration, there are two cases:
|
||||
- if the current price is the lowest, set the buyprice to the lowest one
|
||||
- if the current price minus the `buyprice` is bigger tham profit, record that to profit.
|
||||
|
||||
So, the magic part happens **at setting the buyprice**, because the best profit will and only will occur **after the lowest buyprice is set**, thus we can find best solution in one run.
|
||||
|
||||
### Solution
|
||||
|
||||
Time O(2n) Space O(n) solution (inefficient reverse kadane's algorithm)
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
int maxProfit(vector<int> &prices) {
|
||||
// Dynamic programming. and hash table.
|
||||
int size = prices.size();
|
||||
unordered_map<int, int> localmax;
|
||||
int max = 0;
|
||||
|
||||
// populate localmax: max value after this one
|
||||
// the first one
|
||||
localmax[size - 1] = prices[size - 1];
|
||||
for (int i = size - 2; i >= 0; i--) {
|
||||
localmax[i] = std::max(prices[i + 1], localmax[i + 1]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (localmax[i] - prices[i] > max) {
|
||||
max = localmax[i] - prices[i];
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Kadane's algorithm, Time O(n) Space O(1)
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
int maxProfit(vector<int> &prices) {
|
||||
// Kadane's algorithm
|
||||
// buyprice == min(buyprice, prices[i])
|
||||
int buyprice = INT_MAX;
|
||||
int profit = 0;
|
||||
|
||||
for (int i = 0; i < prices.size(); i++) {
|
||||
buyprice = min(buyprice, prices[i]);
|
||||
|
||||
profit = max(prices[i] - buyprice, profit);
|
||||
}
|
||||
|
||||
return profit;
|
||||
}
|
||||
};
|
||||
```
|
|
@ -0,0 +1,82 @@
|
|||
# Leetcode First-Unique-Character-In-a-String
|
||||
|
||||
#### 2022-06-14 13:10
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm
|
||||
##### Data structures:
|
||||
#DS #string #array #hash_table
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#string OR tag:#hash_table
|
||||
```
|
||||
|
||||
- [[cpp_std_unordered_map]]
|
||||
- [[Leetcode Ransom-Note]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/first-unique-character-in-a-string/)
|
||||
___
|
||||
### Problem
|
||||
Given a string `s`, _find the first non-repeating character in it and return its index_. If it does not exist, return `-1`.
|
||||
|
||||
#### Examples
|
||||
|
||||
**Example 1:**
|
||||
```markdown
|
||||
**Input:** s = "leetcode"
|
||||
**Output:** 0
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "loveleetcode"
|
||||
**Output:** 2
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "aabb"
|
||||
**Output:** -1
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
- `1 <= s.length <= 105`
|
||||
- `s` consists of only lowercase English letters.
|
||||
|
||||
### Thoughts
|
||||
|
||||
Really, really simple hash map problem.
|
||||
Shouldn't have taken so much time.
|
||||
> [!summary]
|
||||
> Don't overlook simple problems! #tip
|
||||
|
||||
### Solution
|
||||
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
int firstUniqChar(string s) {
|
||||
// O(1) hashmap
|
||||
int umap[26] = {};
|
||||
|
||||
int sSize = s.size();
|
||||
for (int i = 0; i < sSize; i++) {
|
||||
umap[s[i] - 'a']++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sSize; i++) {
|
||||
if (umap[s[i] - 'a'] == 1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
```
|
89
CS notes/pages/Leetcode Intersection-of-Two-Arrays-II.md
Normal file
89
CS notes/pages/Leetcode Intersection-of-Two-Arrays-II.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
# Leetcode Intersection-of-Two-Arrays-II
|
||||
|
||||
#### 2022-06-11
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #unordered_map
|
||||
##### Algorithms:
|
||||
#algorithm #two_pointers #sort
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#unordered_map OR tag:#two_pointers OR tag:#sort
|
||||
```
|
||||
|
||||
- [[cpp_std_sort]]
|
||||
- [[cpp_std_unordered_map]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/intersection-of-two-arrays-ii/)
|
||||
- [Solution 2(two pointers method)](https://leetcode.com/problems/intersection-of-two-arrays-ii/discuss/846181/C%2B%2B-Solutions-or-1-%3A-Map-or-2-%3A-Two-Pointer-with-sort)
|
||||
- [Solution 3 and 4](https://leetcode.com/problems/intersection-of-two-arrays-ii/discuss/82243/Solution-to-3rd-follow-up-question)
|
||||
|
||||
___
|
||||
### Problem
|
||||
Given two integer arrays `nums1` and `nums2`, return _an array of their intersection_. Each element in the result must appear as many times as it shows in both arrays and you may return the result in **any order**.
|
||||
|
||||
**Follow up:**
|
||||
|
||||
- What if the given array is already sorted? How would you optimize your algorithm?
|
||||
- What if `nums1`'s size is small compared to `nums2`'s size? Which algorithm is better?
|
||||
- What if elements of `nums2` are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
|
||||
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
**Input:** nums1 = [1,2,2,1], nums2 = [2,2]
|
||||
**Output:** [2,2]
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
**Input:** nums1 = [4,9,5], nums2 = [9,4,9,8,4]
|
||||
**Output:** [4,9]
|
||||
**Explanation:** [9,4] is also accepted.
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
- 1 <= nums1.length, nums2.length <= 1000
|
||||
- 0 <= nums1[i], nums2[i] <= 1000
|
||||
|
||||
### Thoughts
|
||||
|
||||
For the original problem, I thought up an O(m + n) algo, that uses C++'s [[cpp_std_unordered_map]], and for the second one, I use double pointer method.
|
||||
|
||||
> [!tip] Use [[cpp_std_unordered_map]] for a O(1) hash table when not sorted #tip
|
||||
|
||||
> [!tip] Use [[cpp_std_sort]] to sort anything. #tip
|
||||
|
||||
### Solution
|
||||
Unordered map way O(m + n)
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
|
||||
vector<int> answer;
|
||||
unordered_map<int, int> umap;
|
||||
for (int i = 0; i < nums1.size(); i++) {
|
||||
umap[nums1[i]]++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < nums2.size(); i++) {
|
||||
if (umap[nums2[i]] != 0) {
|
||||
answer.push_back(nums2[i]);
|
||||
umap[nums2[i]]--;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
};
|
||||
```
|
103
CS notes/pages/Leetcode Linked-List-Cycle.md
Normal file
103
CS notes/pages/Leetcode Linked-List-Cycle.md
Normal file
|
@ -0,0 +1,103 @@
|
|||
# Leetcode Linked-List-Cycle
|
||||
|
||||
#### 2022-06-14 21:54
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm #Floyd_s_cycle_finding_algorithm
|
||||
##### Data structures:
|
||||
#DS #linked_list
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#Floyd_s_cycle_finding_algorithm
|
||||
```
|
||||
|
||||
- [[Floyd's Cycle Finding Algorithm]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/linked-list-cycle/)
|
||||
___
|
||||
### Problem
|
||||
Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
|
||||
|
||||
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is connected to. **Note that `pos` is not passed as a parameter**.
|
||||
|
||||
Return `true` _if there is a cycle in the linked list_. Otherwise, return `false`.
|
||||
**Follow up:** Can you solve it using `O(1)` (i.e. constant) memory?
|
||||
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
![example1](https://assets.leetcode.com/uploads/2018/12/07/circularlinkedlist.png)
|
||||
|
||||
```markdown
|
||||
**Input:** head = [3,2,0,-4], pos = 1
|
||||
**Output:** true
|
||||
**Explanation:** There is a cycle in the linked list, where the tail connects to the 1st node (0-indexed).
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
![example2](https://assets.leetcode.com/uploads/2018/12/07/circularlinkedlist_test2.png)
|
||||
|
||||
```markdown
|
||||
**Input:** head = [1,2], pos = 0
|
||||
**Output:** true
|
||||
**Explanation:** There is a cycle in the linked list, where the tail connects to the 0th node.
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
![example3](https://assets.leetcode.com/uploads/2018/12/07/circularlinkedlist_test3.png)
|
||||
|
||||
```markdown
|
||||
**Input:** head = [1], pos = -1
|
||||
**Output:** false
|
||||
**Explanation:** There is no cycle in the linked list.
|
||||
```
|
||||
#### Constraints
|
||||
- The number of the nodes in the list is in the range `[0, 104]`.
|
||||
- `-105 <= Node.val <= 105`
|
||||
- `pos` is `-1` or a **valid index** in the linked-list.
|
||||
|
||||
### Thoughts
|
||||
|
||||
> [!summary]
|
||||
> **Algorithm:**
|
||||
> This is a #Floyd_s_cycle_finding_algorithm.
|
||||
This is pretty straightforward, visit for more info
|
||||
|
||||
### Solution
|
||||
|
||||
O(n)
|
||||
```cpp
|
||||
/**
|
||||
* Definition for singly-linked list.
|
||||
* struct ListNode {
|
||||
* int val;
|
||||
* ListNode *next;
|
||||
* ListNode(int x) : val(x), next(NULL) {}
|
||||
* };
|
||||
*/
|
||||
class Solution {
|
||||
public:
|
||||
bool hasCycle(ListNode *head) {
|
||||
ListNode *slow = head;
|
||||
ListNode *fast = head;
|
||||
|
||||
while (fast != NULL && fast->next != NULL) {
|
||||
slow = slow->next;
|
||||
fast = fast->next->next;
|
||||
|
||||
if (slow == fast) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
94
CS notes/pages/Leetcode Maxinum-subarray.md
Normal file
94
CS notes/pages/Leetcode Maxinum-subarray.md
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Leetcode Maxinum-subarray
|
||||
|
||||
#### 2022-06-09
|
||||
|
||||
---
|
||||
##### Data stuctures:
|
||||
#DS #array
|
||||
##### Algorithms:
|
||||
#algorithm #Kadane_s_algorithm
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/maximum-subarray/)
|
||||
- [Analysis](https://medium.com/@rsinghal757/kadanes-algorithm-dynamic-programming-how-and-why-does-it-work-3fd8849ed73d)
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#Kadane_s_algorithm
|
||||
```
|
||||
|
||||
- [[Kadane's Algorithm]]
|
||||
- [[Leetcode Best-Time-To-Buy-And-Sell-Stock]]
|
||||
|
||||
|
||||
|
||||
### Problem
|
||||
Given an integer array `nums`, find the contiguous subarray (containing at least one number) which has the largest sum and return _its sum_.
|
||||
|
||||
A **subarray** is a **contiguous** part of an array.
|
||||
|
||||
#### Examples
|
||||
Example 1:
|
||||
|
||||
```
|
||||
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
|
||||
Output: 6
|
||||
Explanation: [4,-1,2,1] has the largest sum = 6.
|
||||
```
|
||||
|
||||
Example 2:
|
||||
|
||||
```
|
||||
Input: nums = [1]
|
||||
Output: 1
|
||||
```
|
||||
|
||||
Example 3:
|
||||
|
||||
```
|
||||
Input: nums = [5,4,-1,7,8]
|
||||
Output: 23
|
||||
```
|
||||
|
||||
|
||||
#### Constraints
|
||||
|
||||
- 1 <= nums.length <= 105
|
||||
- -104 <= nums[i] <= 104
|
||||
|
||||
### Solution
|
||||
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
int maxSubArray(vector<int>& nums) {
|
||||
// Kadane's algorithm
|
||||
int local_max = 0;
|
||||
int global_max = INT_MIN;
|
||||
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
// if accumulated local max is smaller than nums,
|
||||
// we use the new one instead, and it must be the biggest.
|
||||
local_max = max(nums[i] + local_max, nums[i]);
|
||||
|
||||
if (local_max > global_max) {
|
||||
// We take note when local_max achieves the peak.
|
||||
global_max = local_max;
|
||||
}
|
||||
}
|
||||
return global_max;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### Thoughts
|
||||
|
||||
This is a [[Kadane's algorithm]] problem, and the philosophy behind it id divide and conquer.
|
||||
local_max is the max accumulated number we've found, and global_max is the max local_max we've found.
|
||||
```cpp
|
||||
local_max = max(nums[i] + local_max, nums[i])
|
||||
```
|
||||
is the key to O(n) complexity.
|
||||
|
||||
> [!hint]
|
||||
> Use the macro INT_MAX and INT_MIN to initialize variables that finds max / min var. #tip
|
169
CS notes/pages/Leetcode Merge-Sorted-Array.md
Normal file
169
CS notes/pages/Leetcode Merge-Sorted-Array.md
Normal file
|
@ -0,0 +1,169 @@
|
|||
# Leetcode Merge-Sorted-Array
|
||||
|
||||
#### 2022-06-10
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #set #multiset #vector
|
||||
##### Algorithms:
|
||||
#algorithm #merge_sort #two_pointers
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#set OR tag:#multiset OR tag:#merge_sort OR tag:#vector OR tag:#two_pointers
|
||||
```
|
||||
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[cpp_std_multiset]]
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/merge-sorted-array/)
|
||||
- [multiset cpp reference](https://leetcode.com/problems/merge-sorted-array/)
|
||||
|
||||
___
|
||||
### Problem
|
||||
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
|
||||
|
||||
**Merge** `nums1` and `nums2` into a single array sorted in **non-decreasing order**.
|
||||
|
||||
The final sorted array should not be returned by the function, but instead be _stored inside the array_ `nums1`. To accommodate this, `nums1` has a length of `m + n`, where the first `m` elements denote the elements that should be merged, and the last `n` elements are set to `0` and should be ignored. `nums2` has a length of `n`.
|
||||
|
||||
#### Examples
|
||||
Example 1:
|
||||
|
||||
```
|
||||
Input: nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3
|
||||
Output: [1,2,2,3,5,6]
|
||||
Explanation: The arrays we are merging are [1,2,3] and [2,5,6].
|
||||
The result of the merge is [1,2,2,3,5,6] with the underlined elements coming from nums1.
|
||||
```
|
||||
|
||||
Example 2:
|
||||
|
||||
```
|
||||
Input: nums1 = [1], m = 1, nums2 = [], n = 0
|
||||
Output: [1]
|
||||
Explanation: The arrays we are merging are [1] and [].
|
||||
The result of the merge is [1].
|
||||
```
|
||||
|
||||
Example 3:
|
||||
|
||||
```
|
||||
Input: nums1 = [0], m = 0, nums2 = [1], n = 1
|
||||
Output: [1]
|
||||
Explanation: The arrays we are merging are [] and [1].
|
||||
The result of the merge is [1].
|
||||
Note that because m = 0, there are no elements in nums1. The 0 is only there to ensure the merge result can fit in nums1.
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
- nums1.length == m + n
|
||||
- nums2.length == n
|
||||
- 0 <= m, n <= 200
|
||||
- 1 <= m + n <= 200
|
||||
- -10E9 <= nums1[i], nums2[j] <= 10E9
|
||||
### Thoughts
|
||||
|
||||
I have came up with three ways.
|
||||
The first one is to use **Merge Sort**, which is fast but slow to implement.
|
||||
And second one is cpp's **[[cpp_std_multiset]]**, which is O(nlog(n))
|
||||
Lastly, use the two pointer apporach, which is O(n)
|
||||
|
||||
The second one can be **optimized**, by using [This approach](https://leetcode.com/problems/merge-sorted-array/discuss/2120436/0ms-Solution-in-C++-using-two-pointers), which writes directly on num1, since there are whitespaces and unused ones will never get overwritten.
|
||||
|
||||
For using cpp, the most difficult thing was actually to use the vector library.
|
||||
|
||||
### Solution
|
||||
|
||||
multiset solution: O(nlogn)
|
||||
```cpp
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
|
||||
multiset<int> mset;
|
||||
for (int i = 0; i < m; i++) {
|
||||
mset.insert(nums1[i]);
|
||||
}
|
||||
for (int i = 0; i < n; i++) {
|
||||
mset.insert(nums2[i]);
|
||||
}
|
||||
|
||||
// write answer
|
||||
auto it = mset.begin();
|
||||
for (int i = 0; i < m + n; i++) {
|
||||
nums1[i] = *it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
double pointer solution: O(m+n) (In c, it will get slower, since vectors are more efficient at inserting.)
|
||||
```cpp
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
|
||||
int slowPtr = 0;
|
||||
|
||||
// Because insert will create space for us.
|
||||
for (int i = 0; i < n; i++) {
|
||||
nums1.pop_back();
|
||||
}
|
||||
|
||||
for (auto i = nums1.begin(); i < n + m + nums1.begin(); i++) {
|
||||
if (slowPtr < n) {
|
||||
if (*i >= nums2[slowPtr]){
|
||||
nums1.insert(i, nums2[slowPtr]);
|
||||
slowPtr++;
|
||||
i--;
|
||||
} else if (i - nums1.begin() == m + slowPtr) { // if we reached the empty space of nums1
|
||||
nums1.insert(i, nums2[slowPtr]);
|
||||
slowPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
c solution( not optimized )
|
||||
```c
|
||||
void insert(int *arr, int numsSize, int loc, int value) {
|
||||
for (int i = numsSize - 1; i > loc; i--) {
|
||||
arr[i] = arr[i - 1];
|
||||
}
|
||||
arr[loc] = value;
|
||||
}
|
||||
|
||||
void merge(int *nums1, int nums1Size, int m, int *nums2, int nums2Size, int n) {
|
||||
int loc = 0;
|
||||
for (int i = 0; i < nums1Size; i++) {
|
||||
if (loc < n) {
|
||||
if (nums1[i] < nums2[loc]) {
|
||||
if (i == m + loc) {
|
||||
insert(nums1, nums1Size, i, nums2[loc]);
|
||||
loc++;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (nums1[i] >= nums2[loc]) {
|
||||
insert(nums1, nums1Size, i, nums2[loc]);
|
||||
loc++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
107
CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md
Normal file
107
CS notes/pages/Leetcode Merge-Two-Sorted-Lists.md
Normal file
|
@ -0,0 +1,107 @@
|
|||
# Leetcode Merge-Two-Sorted-Lists
|
||||
|
||||
#### 2022-06-14 22:57
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm #two_pointers
|
||||
##### Data structures:
|
||||
#DS #linked_list
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#two_pointers
|
||||
```
|
||||
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/merge-two-sorted-lists/)
|
||||
___
|
||||
### Problem
|
||||
You are given the heads of two sorted linked lists `list1` and `list2`.
|
||||
|
||||
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
|
||||
|
||||
Return _the head of the merged linked list_.
|
||||
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
![](https://assets.leetcode.com/uploads/2020/10/03/merge_ex1.jpg)
|
||||
|
||||
```markdown
|
||||
**Input:** list1 = [1,2,4], list2 = [1,3,4]
|
||||
**Output:** [1,1,2,3,4,4]
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```markdown
|
||||
**Input:** list1 = [], list2 = []
|
||||
**Output:** []
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```markdown
|
||||
**Input:** list1 = [], list2 = [0]
|
||||
**Output:** [0]
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
- The number of nodes in both lists is in the range `[0, 50]`.
|
||||
- `-100 <= Node.val <= 100`
|
||||
- Both `list1` and `list2` are sorted in **non-decreasing** order.
|
||||
|
||||
### Thoughts
|
||||
|
||||
This is a #two_pointers algorithm, I've done similar problems at leetcode's array list.
|
||||
The only thing to watch out for is when there is one list remaining, remember to add the tails.
|
||||
### Solution
|
||||
```cpp
|
||||
/**
|
||||
* Definition for singly-linked list.
|
||||
* struct ListNode {
|
||||
* int val;
|
||||
* ListNode *next;
|
||||
* ListNode() : val(0), next(nullptr) {}
|
||||
* ListNode(int x) : val(x), next(nullptr) {}
|
||||
* ListNode(int x, ListNode *next) : val(x), next(next) {}
|
||||
* };
|
||||
*/
|
||||
class Solution {
|
||||
public:
|
||||
ListNode *mergeTwoLists(ListNode *list1, ListNode *list2) {
|
||||
// 2 Pointers, Space and time O(m + n);
|
||||
ListNode *ptr1 = list1;
|
||||
ListNode *ptr2 = list2;
|
||||
ListNode *dummyHead = new ListNode();
|
||||
ListNode *ptr3 = dummyHead;
|
||||
while (ptr2 != NULL && ptr1 != NULL) {
|
||||
|
||||
if (ptr2->val <= ptr1->val) {
|
||||
ptr3->next = ptr2;
|
||||
ptr2 = ptr2->next;
|
||||
} else {
|
||||
ptr3->next = ptr1;
|
||||
ptr1 = ptr1->next;
|
||||
}
|
||||
|
||||
ptr3 = ptr3->next;
|
||||
}
|
||||
|
||||
if (ptr2 == NULL) {
|
||||
ptr3->next = ptr1;
|
||||
} else if (ptr1 == NULL) {
|
||||
ptr3->next = ptr2;
|
||||
}
|
||||
|
||||
return dummyHead->next;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
85
CS notes/pages/Leetcode Pascal's-Triangle.md
Normal file
85
CS notes/pages/Leetcode Pascal's-Triangle.md
Normal file
|
@ -0,0 +1,85 @@
|
|||
# Leetcode Pascal's-Triangle
|
||||
|
||||
#### 2022-06-12
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #array
|
||||
##### Algorithms:
|
||||
#algorithm #recursion #iteration
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#recursion OR tag:#iteration OR tag:#array -tag:#Kadane_s_algorithm
|
||||
```
|
||||
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[Leetcode Reshape-The-Matrix]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/pascals-triangle/)
|
||||
- [Additional resources]()
|
||||
|
||||
___
|
||||
### Problem
|
||||
Given an integer `numRows`, return the first numRows of **Pascal's triangle**.
|
||||
|
||||
In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:
|
||||
|
||||
![Pascal Triangle](https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif)
|
||||
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
```markdown
|
||||
Input: numRows = 5
|
||||
Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```markdown
|
||||
Input: numRows = 1
|
||||
Output: [[1]]
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
- 1 <= numRows <= 30
|
||||
|
||||
### Thoughts
|
||||
|
||||
Very simple and straightforward problem.
|
||||
> [!summary]
|
||||
> answer[i][j] = answer[i - 1][j - 1] + answer[i - 1][j]
|
||||
> except for special cases: i <= 1 etc.
|
||||
|
||||
I worked around special cases using the for loop in j: j = 1 and j < i.
|
||||
|
||||
### Solution
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<vector<int>> generate(int numRows) {
|
||||
vector<vector<int>> answer(numRows);
|
||||
int sum;
|
||||
// Initialize vector
|
||||
answer[0] = vector<int> (1);
|
||||
answer[0][0] = 1;
|
||||
for (int i = 1; i < numRows; i++) {
|
||||
// initialize sub vector
|
||||
answer[i] = vector<int> (i + 1);
|
||||
answer[i][0] = 1;
|
||||
answer[i][i] = 1;
|
||||
for (int j = 1; j < i; j++) {
|
||||
answer[i][j] = answer[i - 1][j] + answer[i - 1][j - 1];
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
};
|
||||
```
|
82
CS notes/pages/Leetcode Ransom-Note.md
Normal file
82
CS notes/pages/Leetcode Ransom-Note.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
# Leetcode Ransom-Note
|
||||
|
||||
#### 2022-06-14 13:19
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm #hash_table
|
||||
##### Data structures:
|
||||
#DS #string #array
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#hash_table
|
||||
```
|
||||
|
||||
- [[cpp_std_unordered_map]]
|
||||
- [[Leetcode First-Unique-Character-In-a-String]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/ransom-note/)
|
||||
___
|
||||
### Problem
|
||||
Given two strings `ransomNote` and `magazine`, return `true` _if_ `ransomNote` _can be constructed by using the letters from_ `magazine` _and_ `false` _otherwise_.
|
||||
|
||||
Each letter in `magazine` can only be used once in `ransomNote`.
|
||||
|
||||
#### Examples
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "leetcode"
|
||||
**Output:** 0
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "loveleetcode"
|
||||
**Output:** 2
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "aabb"
|
||||
**Output:** -1
|
||||
```
|
||||
#### Constraints
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `1 <= s.length <= 105`
|
||||
- `s` consists of only lowercase English letters.
|
||||
|
||||
### Thoughts
|
||||
|
||||
Super simple hash map, similar to [[Leetcode First-Unique-Character-In-a-String]]
|
||||
|
||||
### Solution
|
||||
O(m + n)
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
bool canConstruct(string ransomNote, string magazine) {
|
||||
// hashmap, O(m + n)
|
||||
int hashMap[26] = {};
|
||||
|
||||
for (char c : magazine) {
|
||||
hashMap[c - 'a']++;
|
||||
}
|
||||
|
||||
for (char c : ransomNote) {
|
||||
if (hashMap[c - 'a']-- == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
```
|
120
CS notes/pages/Leetcode Reshape-The-Matrix.md
Normal file
120
CS notes/pages/Leetcode Reshape-The-Matrix.md
Normal file
|
@ -0,0 +1,120 @@
|
|||
# Leetcode Reshape-The-Matrix
|
||||
|
||||
#### 2022-06-12
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #array #vector
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
(tag:#array OR tag:#vector) -tag:#Kadane_s_algorithm
|
||||
```
|
||||
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Pascal's-Triangle]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
- [[Leetcode Valid-Sodoku]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/reshape-the-matrix/)
|
||||
___
|
||||
### Problem
|
||||
In MATLAB, there is a handy function called `reshape` which can reshape an `m x n` matrix into a new one with a different size `r x c` keeping its original data.
|
||||
|
||||
You are given an `m x n` matrix `mat` and two integers `r` and `c` representing the number of rows and the number of columns of the wanted reshaped matrix.
|
||||
|
||||
The reshaped matrix should be filled with all the elements of the original matrix in the same row-traversing order as they were.
|
||||
|
||||
If the `reshape` operation with given parameters is possible and legal, output the new reshaped matrix; Otherwise, output the original matrix.
|
||||
|
||||
#### Examples
|
||||
```markdown
|
||||
**Input:** mat = [[1,2],[3,4]], r = 1, c = 4
|
||||
**Output:** [[1,2,3,4]]
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
- m == mat.length
|
||||
- n == mat[i].length
|
||||
- 1 <= m, n <= 100
|
||||
- -1000 <= mat[i][j] <= 1000
|
||||
- 1 <= r, c <= 300
|
||||
|
||||
### Thoughts
|
||||
|
||||
First is the O(mn) solution, I use nested for loop with two additional vars
|
||||
|
||||
Then, from the hint, I know we can transform any array to 1-D, then transform 1-D to any array, that is to said:
|
||||
|
||||
> [!summary]
|
||||
> For arr[m][n] and ans[r][c] and iterator i, with temp 1-D array temp[i]:
|
||||
> temp[i] = arr[i / n][i % n] = ans[i / c][i % c]
|
||||
|
||||
### Solution
|
||||
|
||||
O(nm) solution using two loops
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<vector<int>> matrixReshape(vector<vector<int>> &mat, int r, int c) {
|
||||
// Initialize the answer vector
|
||||
vector<vector<int>> ans(r);
|
||||
for (int i = 0; i < ans.size(); i++) {
|
||||
ans[i] = vector<int>(c);
|
||||
}
|
||||
|
||||
// if the vector is not possible, return original.
|
||||
if (mat[0].size() * mat.size() != r * c) {
|
||||
return mat;
|
||||
}
|
||||
|
||||
int rCounter = 0;
|
||||
int cCounter = 0;
|
||||
for (int i = 0; i < mat.size(); i++) {
|
||||
for (int j = 0; j < mat[i].size(); j++) {
|
||||
if (cCounter >= c) {
|
||||
rCounter++;
|
||||
cCounter = cCounter % c;
|
||||
}
|
||||
|
||||
ans[rCounter][cCounter++] = mat[i][j];
|
||||
}
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
O(mn) Solution using one loop
|
||||
> [!tip]
|
||||
> use `vector<vector<int>> ans(r, vector<int>(c));`
|
||||
> to initialize a 2-d vector
|
||||
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<vector<int>> matrixReshape(vector<vector<int>> &mat, int r, int c) {
|
||||
// Initialize the answer vector
|
||||
vector<vector<int>> ans(r, vector<int>(c));
|
||||
|
||||
int m = mat.size();
|
||||
int n = mat[0].size();
|
||||
int total = m * n;
|
||||
|
||||
// if the vector is not possible, return original.
|
||||
if (total != r * c) {
|
||||
return mat;
|
||||
}
|
||||
|
||||
for (int i = 0; i < total; i++) {
|
||||
ans[i / c][i % c] = mat[i / n][i % n];
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
};
|
||||
```
|
97
CS notes/pages/Leetcode Search-a-2D-Matrix.md
Normal file
97
CS notes/pages/Leetcode Search-a-2D-Matrix.md
Normal file
|
@ -0,0 +1,97 @@
|
|||
# Leetcode Search-a-2D-Matrix
|
||||
|
||||
#### 2022-06-13 15:33
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm #binary_search
|
||||
##### Data structures:
|
||||
#DS #vector #vector_2d
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#vector OR tag:#vector_2d OR tag:#binary_search
|
||||
```
|
||||
|
||||
- [[Binary Search Algorithm]]
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Reshape-The-Matrix]]
|
||||
- [[Leetcode Valid-Sodoku]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/search-a-2d-matrix/submissions/)
|
||||
___
|
||||
### Problem
|
||||
Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
|
||||
|
||||
- Integers in each row are sorted from left to right.
|
||||
- The first integer of each row is greater than the last integer of the previous row.
|
||||
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
![exapmle1](https://assets.leetcode.com/uploads/2020/10/05/mat.jpg)
|
||||
|
||||
```markdown
|
||||
**Input:** matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
|
||||
**Output:** true
|
||||
```
|
||||
**Example 2:**
|
||||
|
||||
![exapmle2](https://assets.leetcode.com/uploads/2020/10/05/mat2.jpg)
|
||||
|
||||
```matrix
|
||||
**Input:** matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13
|
||||
**Output:** false
|
||||
```
|
||||
#### Constraints
|
||||
- m == matrix.length
|
||||
- n == matrix[i].length
|
||||
- 1 <= m, n <= 100
|
||||
- -104 <= matrix[i][j], target <= 104
|
||||
|
||||
### Thoughts
|
||||
|
||||
Binary search algorithm, with simple 2-d to 1-d conversion
|
||||
> [!tip] Binary search while loops
|
||||
> In binary search, remember to check for:
|
||||
> - l <= r
|
||||
> And use:
|
||||
> - l = mid + 1
|
||||
> - r = mid - 1
|
||||
### Solution
|
||||
|
||||
==note how I calculated the mid, i, j, and how I changed r and l==
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
bool searchMatrix(vector<vector<int>> &matrix, int target) {
|
||||
int m = matrix.size();
|
||||
int n = matrix[0].size();
|
||||
int l = 0;
|
||||
int r = m * n - 1;
|
||||
int i; // the key to speed is to precaculate i and j, to save time.
|
||||
int j;
|
||||
int mid;
|
||||
|
||||
do {
|
||||
mid = l + (r - l) / 2;
|
||||
i = mid / n;
|
||||
j = mid % n;
|
||||
if (target == matrix[i][j]) {
|
||||
return true;
|
||||
} else if (target < matrix[i][j]) {
|
||||
r = mid - 1;
|
||||
} else {
|
||||
l = mid + 1;
|
||||
}
|
||||
} while (l <= r);
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
112
CS notes/pages/Leetcode Two-Sum.md
Normal file
112
CS notes/pages/Leetcode Two-Sum.md
Normal file
|
@ -0,0 +1,112 @@
|
|||
# Leetcode Two Sum
|
||||
|
||||
#### 2022-06-10
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #array #map #unordered_map
|
||||
##### Algorithms:
|
||||
#algorithm
|
||||
##### Difficulty:
|
||||
#coding_problem #leetcode #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#map OR tag:#unordered_map
|
||||
```
|
||||
|
||||
- [[cpp_std_unordered_map]]
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/two-sum)
|
||||
- [O(n) Solution](https://leetcode.com/problems/two-sum/discuss/13/Accepted-C++-O(n)-Solution/263)
|
||||
|
||||
___
|
||||
### Problem
|
||||
Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
|
||||
|
||||
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
|
||||
|
||||
You can return the answer in any order.
|
||||
|
||||
#### Examples
|
||||
|
||||
Example 1:
|
||||
|
||||
```
|
||||
Input: nums = [2,7,11,15], target = 9
|
||||
Output: [0,1]
|
||||
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
|
||||
```
|
||||
|
||||
Example 2:
|
||||
|
||||
```
|
||||
Input: nums = [3,2,4], target = 6
|
||||
Output: [1,2]
|
||||
```
|
||||
|
||||
Example 3:
|
||||
|
||||
```
|
||||
Input: nums = [3,3], target = 6
|
||||
Output: [0,1]
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
- `2 <= nums.length <= 104`
|
||||
- `-109 <= nums[i] <= 109`
|
||||
- `-109 <= target <= 109`
|
||||
- **Only one valid answer exists.**
|
||||
|
||||
### Thoughts
|
||||
|
||||
Firstly, I think up an easy O(n^2) solution, by using a nested loop,
|
||||
But the best solution utilizes an __[[cpp_std_unordered_map]]__.
|
||||
|
||||
> [!tips]
|
||||
> Use **[[cpp_std_unordered_map | unordered map]]** to create a hash table, it has O(1) in search, delete and insert. #tip
|
||||
|
||||
### Solution
|
||||
|
||||
O(n^2) solution
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> twoSum(vector<int>& nums, int target) {
|
||||
vector<int> pair;
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
for (int j = i + 1; j < nums.size(); j++) {
|
||||
if (nums[i] + nums[j] == target) {
|
||||
pair.insert(pair.begin(), i);
|
||||
pair.insert(pair.begin(), j);
|
||||
return pair;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pair;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
O(n) solution
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> twoSum(vector<int>& nums, int target) {
|
||||
// use unordered_map here.
|
||||
unordered_map<int, int> umap;
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
auto search = umap.find(target - nums[i]);
|
||||
if ( search != umap.end()) {
|
||||
return vector<int> {i, search->second};
|
||||
}
|
||||
|
||||
umap[nums[i]] = i;
|
||||
}
|
||||
return vector<int> {0, 0};
|
||||
}
|
||||
};
|
||||
```
|
85
CS notes/pages/Leetcode Valid-Anagram.md
Normal file
85
CS notes/pages/Leetcode Valid-Anagram.md
Normal file
|
@ -0,0 +1,85 @@
|
|||
# Leetcode Valid-Anagram
|
||||
|
||||
#### 2022-06-14 13:36
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm #hash_table
|
||||
##### Data structures:
|
||||
#DS #array
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#array tag:#hash_table
|
||||
```
|
||||
|
||||
- [[Leetcode First-Unique-Character-In-a-String]]
|
||||
- [[Leetcode Ransom-Note]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/valid-anagram/)
|
||||
___
|
||||
### Problem
|
||||
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
|
||||
|
||||
An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
|
||||
|
||||
**Follow up:** What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
|
||||
#### Examples
|
||||
**Example 1:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "anagram", t = "nagaram"
|
||||
**Output:** true
|
||||
```
|
||||
**Example 2:**
|
||||
|
||||
```markdown
|
||||
**Input:** s = "rat", t = "car"
|
||||
**Output:** false
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
- `1 <= s.length, t.length <= 5 * 104`
|
||||
- `s` and `t` consist of lowercase English letters.
|
||||
|
||||
### Thoughts
|
||||
|
||||
The difference between this and [[Leetcode Ransom-Note]] is that ransom note checks the hash table one way, and this one is bidirectional, which means not only hash map has to be >= 0, it also has to be <= 0, which results in it can only be 0.
|
||||
|
||||
> [!tip]- To understand that
|
||||
> Compare this solution with [[Leetcode Ransom-Note#Solution]]
|
||||
> to better understand what I mean.
|
||||
|
||||
**Follow up question:**
|
||||
Refer to this [site](https://www.cprogramming.com/tutorial/unicode.html) and this [answer](https://stackoverflow.com/questions/3010739/how-to-use-unicode-in-c/3019339#3019339)
|
||||
|
||||
### Solution
|
||||
|
||||
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
bool isAnagram(string s, string t) {
|
||||
int hashTable[26] = {};
|
||||
|
||||
for (char c : s) {
|
||||
hashTable[c - 'a']++;
|
||||
}
|
||||
|
||||
for (char c : t) {
|
||||
hashTable[c - 'a']--;
|
||||
}
|
||||
|
||||
for (int i : hashTable) {
|
||||
if (i != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
210
CS notes/pages/Leetcode Valid-Sodoku.md
Normal file
210
CS notes/pages/Leetcode Valid-Sodoku.md
Normal file
|
@ -0,0 +1,210 @@
|
|||
# Leetcode Valid-Sodoku
|
||||
|
||||
#### 2022-06-13 12:56
|
||||
|
||||
---
|
||||
##### Data structures:
|
||||
#DS #vector
|
||||
##### Difficulty:
|
||||
#leetcode #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#vector
|
||||
```
|
||||
|
||||
- [[cpp_Range_based_for_loop]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Reshape-The-Matrix]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem](https://leetcode.com/problems/valid-sudoku/)
|
||||
- [Simple solution](https://leetcode.com/problems/valid-sudoku/discuss/15464/My-short-solution-by-C%2B%2B.-O(n2))
|
||||
___
|
||||
### Problem
|
||||
|
||||
Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
|
||||
|
||||
1. Each row must contain the digits `1-9` without repetition.
|
||||
2. Each column must contain the digits `1-9` without repetition.
|
||||
3. Each of the nine `3 x 3` sub-boxes of the grid must contain the digits `1-9` without repetition.
|
||||
|
||||
**Note:**
|
||||
|
||||
- A Sudoku board (partially filled) could be valid but is not necessarily solvable.
|
||||
- Only the filled cells need to be validated according to the mentioned rules.
|
||||
|
||||
#### Examples
|
||||
![[Pasted image 20220613125739.png]]
|
||||
```markdown
|
||||
**Input:** board =
|
||||
[["5","3",".",".","7",".",".",".","."]
|
||||
,["6",".",".","1","9","5",".",".","."]
|
||||
,[".","9","8",".",".",".",".","6","."]
|
||||
,["8",".",".",".","6",".",".",".","3"]
|
||||
,["4",".",".","8",".","3",".",".","1"]
|
||||
,["7",".",".",".","2",".",".",".","6"]
|
||||
,[".","6",".",".",".",".","2","8","."]
|
||||
,[".",".",".","4","1","9",".",".","5"]
|
||||
,[".",".",".",".","8",".",".","7","9"]]
|
||||
**Output:** true
|
||||
```
|
||||
|
||||
```markdown
|
||||
**Input:** board =
|
||||
[["8","3",".",".","7",".",".",".","."]
|
||||
,["6",".",".","1","9","5",".",".","."]
|
||||
,[".","9","8",".",".",".",".","6","."]
|
||||
,["8",".",".",".","6",".",".",".","3"]
|
||||
,["4",".",".","8",".","3",".",".","1"]
|
||||
,["7",".",".",".","2",".",".",".","6"]
|
||||
,[".","6",".",".",".",".","2","8","."]
|
||||
,[".",".",".","4","1","9",".",".","5"]
|
||||
,[".",".",".",".","8",".",".","7","9"]]
|
||||
**Output:** false
|
||||
**Explanation:** Same as Example 1, except with the **5** in the top left corner being modified to **8**. Since there are two 8's in the top left 3x3 sub-box, it is invalid.
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
- board.length == 9
|
||||
- board[i].length == 9
|
||||
- board[i][j] is a digit `1-9` or `'.'`.
|
||||
|
||||
### Thoughts
|
||||
|
||||
This should be a follow-up of [[Leetcode Reshape-The-Matrix]], I tried to implement using unordered set, but regular arrays should suffice.
|
||||
|
||||
Besides overthinking, I also spent a lot of time learning how to use sets and init multi-dimensional vectors.
|
||||
|
||||
### Solution
|
||||
Bad solution :(
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
bool isValidSudoku(vector<vector<char>> &board) {
|
||||
// store info as unordered_set
|
||||
// even(it % 2 == 0):
|
||||
// horizontal
|
||||
// odd(it % 2 == 1):
|
||||
// vertical
|
||||
vector<vector<vector<unordered_set<int>>>> sets(9);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
sets[i] = vector<vector<unordered_set<int>>>(2);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
sets[i][j] = vector<unordered_set<int>>(3);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// populate set[i][0], horizontal
|
||||
for (int j = 3 * (i / 3); j < 3 * (i / 3) + 3; j++) { // iterate rows
|
||||
for (int k = 3 * (i % 3); k < 3 * (i % 3) + 3;
|
||||
k++) { // iterate over cols
|
||||
if (board[j][k] >= '0' && board[j][k] <= '9') {
|
||||
// Insert that if it is a number
|
||||
auto valPair = sets[i][0][j % 3].insert(board[j][k] - '0');
|
||||
// there is a duplicate
|
||||
if (valPair.second == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the whole set is empty
|
||||
bool is_empty = true;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (!sets[i][0][j].empty()) {
|
||||
is_empty = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (is_empty == true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check sets[i][0][*] is legit, and move data to set[i][0][0]
|
||||
unordered_set<int> tmp;
|
||||
for (auto tmpsets : sets[i][0]) {
|
||||
for (int j : tmpsets) {
|
||||
auto result = tmp.insert(j);
|
||||
if (result.second == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// populate set[i][0], vertically
|
||||
for (int k = 3 * (i % 3); k < 3 * (i % 3) + 3; k++) { // iterate over cols
|
||||
for (int j = 3 * (i / 3); j < 3 * (i / 3) + 3; j++) { // iterate rows
|
||||
if (board[j][k] >= '0' && board[j][k] <= '9') {
|
||||
// Insert that if it is a number
|
||||
auto valPair = sets[i][1][k % 3].insert(board[j][k] - '0');
|
||||
// there is a duplicate
|
||||
if (valPair.second == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check each row and col.
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int k = 0; k < 3; k++) {
|
||||
// check for rows
|
||||
if (i % 3 != 2) {
|
||||
sets[i + 1][0][k].merge(sets[i][0][k]);
|
||||
if (!sets[i][0][k].empty()) {
|
||||
printf("Found at %d\n", i);
|
||||
for (int val : sets[i][0][k]) {
|
||||
printf("%d ", val);
|
||||
}
|
||||
printf("\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check for cols
|
||||
if (i < 6) {
|
||||
sets[i + 3][1][k].merge(sets[i][1][k]);
|
||||
if (!sets[i][1][k].empty()) {
|
||||
printf("Found duplicated col at %d, %d\n", i, k);
|
||||
for (int val : sets[i][1][k]) {
|
||||
printf("%d ", val);
|
||||
}
|
||||
printf("\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
Others' using array.
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
bool isValidSudoku(vector<vector<char>> &board) {
|
||||
int used1[9][9] = {0}, used2[9][9] = {0}, used3[9][9] = {0};
|
||||
|
||||
for (int i = 0; i < board.size(); ++i)
|
||||
for (int j = 0; j < board[i].size(); ++j)
|
||||
if (board[i][j] != '.') {
|
||||
int num = board[i][j] - '0' - 1, k = i / 3 * 3 + j / 3;
|
||||
if (used1[i][num] || used2[j][num] || used3[k][num])
|
||||
return false;
|
||||
used1[i][num] = used2[j][num] = used3[k][num] = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
```
|
33
CS notes/pages/Two pointers approach.md
Normal file
33
CS notes/pages/Two pointers approach.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Two pointers approach
|
||||
|
||||
#### 2022-06-14 23:06
|
||||
|
||||
___
|
||||
##### Algorithms:
|
||||
#algorithm #two_pointers
|
||||
##### Data structures:
|
||||
#array #linked_list
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#two_pointers -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
- [[Leetcode Merge-Two-Sorted-Lists]]
|
||||
|
||||
|
||||
##### Links:
|
||||
- [leetcode](https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/)
|
||||
___
|
||||
|
||||
### What is Two pointers approach?
|
||||
By using two pointers, to in place modify array elements.
|
||||
- One fast and one slow [[Leetcode Best-Time-To-Buy-And-Sell-Stock]] or [[Leetcode Linked-List-Cycle]]
|
||||
- The two are unordered [[Leetcode Merge-Two-Sorted-Lists]]
|
||||
|
||||
### Why and when to use it?
|
||||
- There are two arrays, or linked lists
|
||||
- They are sorted, or operation in place will not interfere elements after.
|
97
CS notes/pages/cpp_Range_based_for_loop.md
Normal file
97
CS notes/pages/cpp_Range_based_for_loop.md
Normal file
|
@ -0,0 +1,97 @@
|
|||
# cpp_Range_based_for_loop
|
||||
|
||||
#### 2022-06-11
|
||||
|
||||
___
|
||||
##### Data structures:
|
||||
#DS #array #vector #multiset
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#array tag:#vector tag:#multiset -tag:#template_remove_me
|
||||
```
|
||||
|
||||
|
||||
##### Links:
|
||||
- [cppreference](https://en.cppreference.com/w/cpp/language/range-for)
|
||||
___
|
||||
|
||||
### What is cpp_Range_based_for_loop?
|
||||
Executes a for loop over a range.
|
||||
|
||||
Used as a more readable equivalent to the traditional [for loop](https://en.cppreference.com/w/cpp/language/for "cpp/language/for") operating over a range of values, such as all elements in a container.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<int> v = {0, 1, 2, 3, 4, 5};
|
||||
|
||||
for (const int& i : v) // access by const reference
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
for (auto i : v) // access by value, the type of i is int
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
for (auto&& i : v) // access by forwarding reference, the type of i is int&
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
const auto& cv = v;
|
||||
|
||||
for (auto&& i : cv) // access by f-d reference, the type of i is const int&
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
for (int n : {0, 1, 2, 3, 4, 5}) // the initializer may be a braced-init-list
|
||||
std::cout << n << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
int a[] = {0, 1, 2, 3, 4, 5};
|
||||
for (int n : a) // the initializer may be an array
|
||||
std::cout << n << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
for ([[maybe_unused]] int n : a)
|
||||
std::cout << 1 << ' '; // the loop variable need not be used
|
||||
std::cout << '\n';
|
||||
|
||||
for (auto n = v.size(); auto i : v) // the init-statement (C++20)
|
||||
std::cout << --n + i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
for (typedef decltype(v)::value_type elem_t; elem_t i : v)
|
||||
// typedef declaration as init-statement (C++20)
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
|
||||
#if __cplusplus > 23'00 + 200000
|
||||
for (using elem_t = decltype(v)::value_type; elem_t i : v)
|
||||
// alias declaration as init-statement, same as above (C++23)
|
||||
std::cout << i << ' ';
|
||||
std::cout << '\n';
|
||||
#endif
|
||||
}
|
||||
```
|
||||
|
||||
Possible output:
|
||||
```
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
1 1 1 1 1 1
|
||||
5 5 5 5 5 5
|
||||
0 1 2 3 4 5
|
||||
0 1 2 3 4 5
|
||||
```
|
25
CS notes/pages/cpp_std_multiset.md
Normal file
25
CS notes/pages/cpp_std_multiset.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Multiset
|
||||
|
||||
#### 2022-06-12
|
||||
|
||||
___
|
||||
##### Data structures:
|
||||
#DS #multiset
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#multiset -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Merge-Sorted-Array]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [cppreference](https://en.cppreference.com/w/cpp/container/multiset)
|
||||
___
|
||||
|
||||
### What is Multiset?
|
||||
|
||||
`std::multiset` is an associative container that contains a sorted set of objects of type Key. Unlike set, multiple keys with equivalent values are allowed. Sorting is done using the key comparison function Compare. Search, insertion, and removal operations have logarithmic complexity.
|
64
CS notes/pages/cpp_std_sort.md
Normal file
64
CS notes/pages/cpp_std_sort.md
Normal file
|
@ -0,0 +1,64 @@
|
|||
# Sort
|
||||
|
||||
#### 2022-06-11
|
||||
|
||||
___
|
||||
##### Algorithms:
|
||||
#algorithm #sort
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#sort -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [cpp reference](https://en.cppreference.com/w/cpp/algorithm/sort)
|
||||
___
|
||||
|
||||
### What is Sort?
|
||||
Sorts the elements in the range `[first, last)` in non-descending order. The order of equal elements is not guaranteed to be preserved.
|
||||
|
||||
The default Compare function is less: `<`
|
||||
|
||||
### Example
|
||||
```cpp
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string_view>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::array<int, 10> s = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
|
||||
|
||||
auto print = [&s](std::string_view const rem) {
|
||||
for (auto a : s) {
|
||||
std::cout << a << ' ';
|
||||
}
|
||||
std::cout << ": " << rem << '\n';
|
||||
};
|
||||
|
||||
std::sort(s.begin(), s.end());
|
||||
print("sorted with the default operator<");
|
||||
|
||||
std::sort(s.begin(), s.end(), std::greater<int>());
|
||||
print("sorted with the standard library compare function object");
|
||||
|
||||
struct {
|
||||
bool operator()(int a, int b) const { return a < b; }
|
||||
} customLess;
|
||||
std::sort(s.begin(), s.end(), customLess);
|
||||
print("sorted with a custom function object");
|
||||
|
||||
std::sort(s.begin(), s.end(), [](int a, int b) {
|
||||
return a > b;
|
||||
});
|
||||
print("sorted with a lambda expression");
|
||||
}
|
||||
```
|
90
CS notes/pages/cpp_std_unordered_map.md
Normal file
90
CS notes/pages/cpp_std_unordered_map.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Unordered Map
|
||||
|
||||
#### 2022-06-10
|
||||
|
||||
___
|
||||
##### Data structures:
|
||||
#DS #unordered_map #hash_table
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-easy
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#unordered_map -tag:#template_remove_me
|
||||
```
|
||||
|
||||
- [[Leetcode Intersection-of-Two-Arrays-II]]
|
||||
- [[Leetcode Two-Sum]]
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Unordered map explainer](https://www.geeksforgeeks.org/unordered_map-in-cpp-stl/)
|
||||
- [Unordered map vs ordered map](https://www.geeksforgeeks.org/unordered_map-in-cpp-stl/)
|
||||
- [cpp reference](https://en.cppreference.com/w/cpp/container/unordered_map)
|
||||
___
|
||||
|
||||
### What is Unordered Map?
|
||||
|
||||
I see unordered map as a convenient O(1) hash map:
|
||||
|
||||
> unordered_map is an associated container that stores elements formed by the combination of key-value and a mapped value. The key value is used to uniquely identify the element and the mapped value is the content associated with the key. Both key and value can be of any type predefined or user-defined.
|
||||
|
||||
Internally unordered_map is implemented using [Hash Table](https://www.geeksforgeeks.org/hashing-set-1-introduction/), the key provided to map are hashed into indices of a hash table that is why the performance of data structure depends on hash function a lot but on an average, the cost of **search, insert and delete** from the hash table is O(1).
|
||||
|
||||
> [!note]- When to use map instead of unordered map
|
||||
> In the worst case, its time complexity can go from O(1) to O(n2), especially for big prime numbers. You can read more about this on [how-to-use-unordered_map-efficiently-in-c](https://www.geeksforgeeks.org/map-vs-unordered_map-c/). In this situation, it is highly advisable to use a map instead to avoid getting a TLE error.
|
||||
|
||||
### How to use
|
||||
|
||||
Example taken from [g4g](https://www.geeksforgeeks.org/unordered_map-in-cpp-stl/)
|
||||
```cpp
|
||||
// C++ program to demonstrate functionality of unordered_map
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
// Declaring umap to be of <string, double> type
|
||||
// key will be of string type and mapped value will
|
||||
// be of double type
|
||||
unordered_map<string, double> umap;
|
||||
|
||||
// inserting values by using [] operator
|
||||
umap["PI"] = 3.14;
|
||||
umap["root2"] = 1.414;
|
||||
umap["root3"] = 1.732;
|
||||
umap["log10"] = 2.302;
|
||||
umap["loge"] = 1.0;
|
||||
|
||||
// inserting value by insert function
|
||||
umap.insert(make_pair("e", 2.718));
|
||||
|
||||
string key = "PI";
|
||||
|
||||
// If key not found in map iterator to end is returned
|
||||
if (umap.find(key) == umap.end())
|
||||
cout << key << " not found\n\n";
|
||||
|
||||
// If key found then iterator to that key is returned
|
||||
else
|
||||
cout << "Found " << key << "\n\n";
|
||||
|
||||
key = "lambda";
|
||||
if (umap.find(key) == umap.end())
|
||||
cout << key << " not found\n";
|
||||
else
|
||||
cout << "Found " << key << endl;
|
||||
|
||||
// iterating over all value of umap
|
||||
unordered_map<string, double>:: iterator itr;
|
||||
cout << "\nAll Elements : \n";
|
||||
for (itr = umap.begin(); itr != umap.end(); itr++)
|
||||
{
|
||||
// itr works as a pointer to pair<string, double>
|
||||
// type itr->first stores the key part and
|
||||
// itr->second stores the value part
|
||||
cout << itr->first << " " << itr->second << endl;
|
||||
}
|
||||
}
|
||||
```
|
27
Index.md
Normal file
27
Index.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
```
|
||||
__ __ __
|
||||
____ ____ / /____ / /_ ____ ____ / /__
|
||||
/ __ \/ __ \/ __/ _ \/ __ \/ __ \/ __ \/ //_/
|
||||
/ / / / /_/ / /_/ __/ /_/ / /_/ / /_/ / ,<
|
||||
/_/ /_/\____/\__/\___/_.___/\____/\____/_/|_|
|
||||
|
||||
```
|
||||
|
||||
# My notebook
|
||||
|
||||
___
|
||||
## Table of contents
|
||||
|
||||
### Computer science notes
|
||||
- [[CS-index]]
|
||||
|
||||
### Misc
|
||||
- [[Wiki-Index]]
|
||||
|
||||
___
|
||||
## Naming conventions
|
||||
|
||||
- When using titles, capitalize the first character
|
||||
- When tagging, use lowercase when possible, for people's names, capitalize first, and capitalize acronyms
|
||||
- Replace chars that is not available with `_`
|
||||
- Use singular form where possible
|
7
Wiki/.obsidian/app.json
vendored
Normal file
7
Wiki/.obsidian/app.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"legacyEditor": false,
|
||||
"livePreview": true,
|
||||
"vimMode": true,
|
||||
"showLineNumber": true,
|
||||
"tabSize": 2
|
||||
}
|
5
Wiki/.obsidian/appearance.json
vendored
Normal file
5
Wiki/.obsidian/appearance.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"baseFontSize": 16,
|
||||
"translucency": true,
|
||||
"cssTheme": "Reverie"
|
||||
}
|
15
Wiki/.obsidian/core-plugins.json
vendored
Normal file
15
Wiki/.obsidian/core-plugins.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
[
|
||||
"file-explorer",
|
||||
"global-search",
|
||||
"switcher",
|
||||
"graph",
|
||||
"backlink",
|
||||
"page-preview",
|
||||
"note-composer",
|
||||
"command-palette",
|
||||
"editor-status",
|
||||
"markdown-importer",
|
||||
"word-count",
|
||||
"open-with-default-app",
|
||||
"file-recovery"
|
||||
]
|
22
Wiki/.obsidian/graph.json
vendored
Normal file
22
Wiki/.obsidian/graph.json
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"collapse-filter": true,
|
||||
"search": "",
|
||||
"showTags": false,
|
||||
"showAttachments": false,
|
||||
"hideUnresolved": false,
|
||||
"showOrphans": true,
|
||||
"collapse-color-groups": true,
|
||||
"colorGroups": [],
|
||||
"collapse-display": true,
|
||||
"showArrow": false,
|
||||
"textFadeMultiplier": 0,
|
||||
"nodeSizeMultiplier": 1,
|
||||
"lineSizeMultiplier": 1,
|
||||
"collapse-forces": true,
|
||||
"centerStrength": 0.518713248970312,
|
||||
"repelStrength": 10,
|
||||
"linkStrength": 1,
|
||||
"linkDistance": 250,
|
||||
"scale": 2.0468902516286795,
|
||||
"close": false
|
||||
}
|
41
Wiki/.obsidian/hotkeys.json
vendored
Normal file
41
Wiki/.obsidian/hotkeys.json
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"editor:delete-paragraph": [],
|
||||
"editor:toggle-bold": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "B"
|
||||
}
|
||||
],
|
||||
"graph:open": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "G"
|
||||
}
|
||||
],
|
||||
"editor:insert-link": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "K"
|
||||
}
|
||||
],
|
||||
"editor:open-search": [],
|
||||
"editor:open-search-replace": [],
|
||||
"editor:toggle-italics": [
|
||||
{
|
||||
"modifiers": [
|
||||
"Mod",
|
||||
"Shift"
|
||||
],
|
||||
"key": "I"
|
||||
}
|
||||
]
|
||||
}
|
442
Wiki/.obsidian/themes/Reverie.css
vendored
Normal file
442
Wiki/.obsidian/themes/Reverie.css
vendored
Normal file
|
@ -0,0 +1,442 @@
|
|||
/* This Theme is called "Reverie" and Obsidian Theme created by Santi Younger */
|
||||
|
||||
Last Update:
|
||||
2021-03-11 12:06
|
||||
|
||||
:root
|
||||
{
|
||||
--font-monospace: "Source Code Pro", monospace;
|
||||
}
|
||||
|
||||
.theme-dark
|
||||
{
|
||||
--background-primary: #1A2023;
|
||||
--background-primary-alt: #1A2023;
|
||||
--background-secondary: #222B2F;
|
||||
--background-secondary-alt: #073334;
|
||||
--text-normal: #faf2d6;
|
||||
--text-faint: #bdae93;
|
||||
--text-title-h1: #c1dde1;
|
||||
--text-title-h2: #8ab8bd;
|
||||
--text-title-h3: #56a7b0;
|
||||
--text-title-h4: #309093;
|
||||
--text-title-h5: #0b797d;
|
||||
--text-title-h6: #0b797d;
|
||||
--text-highlight-bg: #22a578;
|
||||
--text-link: #83a598;
|
||||
--text-a-hover: #83a598;
|
||||
--inline-code: #83a598;
|
||||
--code-block: #83a598;
|
||||
--text-a: #2ccab7;
|
||||
--interactive-accent: #0b797d;
|
||||
--text-accent: #2ccab7;
|
||||
--text-on-accent: #fff;
|
||||
--interactive-accent-rgb: #2ccab7;
|
||||
--vim-cursor: #2ccab7;
|
||||
/* --text-mark: add text-mark if needed, this should work together with 'mark' */
|
||||
--pre-code: #073334;
|
||||
--interactive-before: #7c6f64;
|
||||
--background-modifier-border: #95c1bb;
|
||||
--text-selection: #16304D;
|
||||
}
|
||||
|
||||
.theme-dark .cm-s-obsidian span.obsidian-search-match-highlight {
|
||||
color: var(--text-normal);
|
||||
background-color: #483699;
|
||||
}
|
||||
|
||||
.theme-light
|
||||
{
|
||||
--background-primary: #e7e7e7;
|
||||
--background-primary-alt: #e7e7e7;
|
||||
--background-secondary: #e3e3e3; /* thick menu border */
|
||||
--background-secondary-alt: #bebebe; /* ← ↓ corner */
|
||||
--text-normal: #1A2023;
|
||||
--text-faint: #665c54;
|
||||
--text-title-h1: #1bb0b6;
|
||||
--text-title-h2: #3fa7ab;
|
||||
--text-title-h3: #458588;
|
||||
--text-title-h4: #4b6667;
|
||||
--text-title-h5: #3b4646;
|
||||
--text-link: #458588;
|
||||
--text-a-hover: #458588;
|
||||
--inline-code: #458588;
|
||||
/* --text-mark: add if needed */
|
||||
--pre-code: #bebebe;
|
||||
/* --text-highlight-bg: add if needed */
|
||||
--interactive-before: #a89984;
|
||||
--background-modifier-border: #1bb0b6;
|
||||
--text-a: #22a578;
|
||||
--interactive-accent: #22a578;
|
||||
--text-accent: #22a578;
|
||||
--interactive-accent-rgb: #22a578;
|
||||
--vim-cursor: #22a578;
|
||||
/* --text-selection: add if needed */
|
||||
}
|
||||
|
||||
.cm-header-1,
|
||||
.markdown-preview-section h1
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h1) !important;
|
||||
}
|
||||
|
||||
.cm-header-2,
|
||||
.markdown-preview-section h2
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h2) !important;
|
||||
}
|
||||
|
||||
.cm-header-3,
|
||||
.markdown-preview-section h3
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h3) !important;
|
||||
}
|
||||
|
||||
.cm-header-4,
|
||||
.markdown-preview-section h4
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h4) !important;
|
||||
}
|
||||
|
||||
.cm-header-5,
|
||||
.markdown-preview-section h5
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h5) !important;
|
||||
}
|
||||
|
||||
.cm-header-6,
|
||||
.markdown-preview-section h6
|
||||
{
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
color: var(--text-title-h5) !important;
|
||||
}
|
||||
|
||||
/* ------------ other basic theme configurations ------------*/
|
||||
|
||||
.theme-dark code[class*="language-"],
|
||||
.theme-dark pre[class*="language-"],
|
||||
.theme-light code[class*="language-"],
|
||||
.theme-light pre[class*="language-"]
|
||||
{
|
||||
text-shadow: none !important;
|
||||
background-color: var(--pre-code) !important;
|
||||
}
|
||||
|
||||
.graph-view.color-circle,
|
||||
.graph-view.color-fill-highlight,
|
||||
.graph-view.color-line-highlight
|
||||
{
|
||||
color: var(--interactive-accent-rgb) !important;
|
||||
}
|
||||
.graph-view.color-text
|
||||
{
|
||||
color: var(--text-a-hover) !important;
|
||||
}
|
||||
/*
|
||||
.graph-view.color-fill
|
||||
{
|
||||
color: var(--background-secondary);
|
||||
}
|
||||
.graph-view.color-line
|
||||
{
|
||||
color: var(--background-modifier-border);
|
||||
}
|
||||
*/
|
||||
|
||||
html,
|
||||
body
|
||||
{
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
strong
|
||||
{
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
a,
|
||||
.cm-hmd-internal-link
|
||||
{
|
||||
color: var(--text-a) !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
.cm-hmd-internal-link:hover,
|
||||
.cm-url
|
||||
{
|
||||
color: var(--text-a-hover) !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
mark
|
||||
{
|
||||
background-color: var(--text-mark) !important;
|
||||
color: #E5A200 !important;
|
||||
}
|
||||
|
||||
.view-actions a
|
||||
{
|
||||
color: var(--text-normal) !important;
|
||||
}
|
||||
|
||||
.view-actions a:hover
|
||||
{
|
||||
color: var(--text-a) !important;
|
||||
}
|
||||
|
||||
.HyperMD-codeblock-bg
|
||||
{
|
||||
background-color: var(--pre-code) !important;
|
||||
}
|
||||
|
||||
.HyperMD-codeblock
|
||||
{
|
||||
line-height: 1.4em !important;
|
||||
color: var(--code-block) !important;
|
||||
}
|
||||
|
||||
.HyperMD-codeblock-begin
|
||||
{
|
||||
border-top-left-radius: 4px !important;
|
||||
border-top-right-radius: 4px !important;
|
||||
}
|
||||
|
||||
.HyperMD-codeblock-end
|
||||
{
|
||||
border-bottom-left-radius: 4px !important;
|
||||
border-bottom-right-radius: 4px !important;
|
||||
}
|
||||
|
||||
th
|
||||
{
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
thead
|
||||
{
|
||||
border-bottom: 2px solid var(--background-modifier-border) !important;
|
||||
}
|
||||
|
||||
.HyperMD-table-row
|
||||
{
|
||||
line-height: normal !important;
|
||||
padding-left: 4px !important;
|
||||
padding-right: 4px !important;
|
||||
/* background-color: var(--pre-code) !important; */
|
||||
}
|
||||
|
||||
.HyperMD-table-row-0
|
||||
{
|
||||
/* padding-top: 4px !important; */
|
||||
}
|
||||
|
||||
.CodeMirror-foldgutter-folded,
|
||||
.is-collapsed .nav-folder-collapse-indicator
|
||||
{
|
||||
color: var(--text-a) !important;
|
||||
}
|
||||
|
||||
.nav-file-tag
|
||||
{
|
||||
color: var(--text-a) !important;
|
||||
}
|
||||
|
||||
.is-active .nav-file-title
|
||||
{
|
||||
color: var(--text-a) !important;
|
||||
background-color: var(--background-primary-alt) !important;
|
||||
}
|
||||
|
||||
.nav-file-title
|
||||
{
|
||||
border-bottom-left-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
img
|
||||
{
|
||||
display: block !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.HyperMD-list-line
|
||||
{
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
|
||||
.CodeMirror-linenumber,
|
||||
.cm-formatting
|
||||
{
|
||||
font-family: var(--font-monospace) !important;
|
||||
}
|
||||
|
||||
.markdown-preview-section pre code,
|
||||
.markdown-preview-section code
|
||||
{
|
||||
font-size: 0.9em !important;
|
||||
background-color: var(--pre-code) !important;
|
||||
}
|
||||
|
||||
.markdown-preview-section pre code
|
||||
{
|
||||
padding: 4px !important;
|
||||
line-height: 1.4em !important;
|
||||
display: block !important;
|
||||
color: var(--code-block) !important;
|
||||
}
|
||||
|
||||
.markdown-preview-section code
|
||||
{
|
||||
color: var(--inline-code) !important;
|
||||
}
|
||||
|
||||
.cm-s-obsidian,
|
||||
.cm-inline-code
|
||||
{
|
||||
-webkit-font-smoothing: auto !important;
|
||||
}
|
||||
|
||||
.cm-inline-code
|
||||
{
|
||||
color: var(--inline-code) !important;
|
||||
background-color: var(--pre-code) !important;
|
||||
padding: 1px !important;
|
||||
}
|
||||
|
||||
.workspace-leaf-header-title
|
||||
{
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.side-dock-title
|
||||
{
|
||||
padding-top: 15px !important;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
|
||||
.side-dock-ribbon-tab:hover,
|
||||
.side-dock-ribbon-action:hover,
|
||||
.side-dock-ribbon-action.is-active:hover,
|
||||
.nav-action-button:hover,
|
||||
.side-dock-collapse-btn:hover
|
||||
{
|
||||
color: var(--text-a);
|
||||
}
|
||||
|
||||
.side-dock
|
||||
{
|
||||
border-right: 0 !important;
|
||||
}
|
||||
|
||||
.cm-s-obsidian,
|
||||
.markdown-preview-view
|
||||
{
|
||||
padding-left: 10px !important;
|
||||
padding-right: 10px !important;
|
||||
}
|
||||
|
||||
/* vertical resize-handle */
|
||||
.workspace-split.mod-vertical > * > .workspace-leaf-resize-handle,
|
||||
.workspace-split.mod-left-split > .workspace-leaf-resize-handle,
|
||||
.workspace-split.mod-right-split > .workspace-leaf-resize-handle
|
||||
{
|
||||
width: 1px !important;
|
||||
background-color: var(--background-secondary-alt);
|
||||
}
|
||||
|
||||
/* horizontal resize-handle */
|
||||
.workspace-split.mod-horizontal > * > .workspace-leaf-resize-handle
|
||||
{
|
||||
height: 1px !important;
|
||||
background-color: var(--background-secondary-alt);
|
||||
}
|
||||
|
||||
/* Remove vertical split padding */
|
||||
.workspace-split.mod-root .workspace-split.mod-vertical .workspace-leaf-content,
|
||||
.workspace-split.mod-vertical > .workspace-split,
|
||||
.workspace-split.mod-vertical > .workspace-leaf,
|
||||
.workspace-tabs
|
||||
{
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.markdown-embed-title
|
||||
{
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.markdown-embed
|
||||
{
|
||||
padding-left: 10px !important;
|
||||
padding-right: 10px !important;
|
||||
margin-left: 10px !important;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
.suggestion-item.is-selected
|
||||
{
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
.empty-state-container:hover
|
||||
{
|
||||
background-color: var(--background-secondary-alt);
|
||||
border: 5px solid var(--interactive-accent) !important;
|
||||
}
|
||||
|
||||
.checkbox-container
|
||||
{
|
||||
background-color: var(--interactive-before);
|
||||
}
|
||||
|
||||
.checkbox-container:after
|
||||
{
|
||||
background-color: var(--background-secondary-alt);
|
||||
}
|
||||
|
||||
.mod-cta
|
||||
{
|
||||
color: var(--background-secondary-alt) !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.mod-cta:hover
|
||||
{
|
||||
background-color: var(--interactive-before) !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
input.task-list-item-checkbox {
|
||||
border: 1px solid #7c6f64;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
input.task-list-item-checkbox:checked {
|
||||
background-color: #7c6f64;
|
||||
box-shadow: inset 0 0 0 2px var(--background-primary);
|
||||
}
|
||||
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
background-color: #2ccab7 !important;
|
||||
opacity: 60% !important;
|
||||
width: 9px !important;
|
||||
visibility: visible !important
|
||||
}
|
||||
|
||||
/*-----------------------------------------*/
|
||||
/* End of main theme, extra functionality can be added below */
|
102
Wiki/.obsidian/workspace
vendored
Normal file
102
Wiki/.obsidian/workspace
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"main": {
|
||||
"id": "6848b5e156e22f4f",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "d16cdf3eabe39fcf",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Vim Plugins.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
},
|
||||
"left": {
|
||||
"id": "ec33f0af1ea3a407",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "cdcd049c670fbdef",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "c5c9d3beb1a27c46",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "272cb52d6965613a",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "7ae73d5e79b0ae66",
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "9d78e53691d86c54",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "6f23ac1a7ec0d6c7",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "Vim Plugins.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
"showSearch": false,
|
||||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
},
|
||||
"active": "d16cdf3eabe39fcf",
|
||||
"lastOpenFiles": [
|
||||
"Vim Plugins.md",
|
||||
"index.md",
|
||||
"Computing Projects.md",
|
||||
"Software Index.md",
|
||||
"Notes for CS.md",
|
||||
"Vim.md",
|
||||
"Software.md",
|
||||
"Software 1.md",
|
||||
"Repositories.md",
|
||||
"Learnings.md"
|
||||
]
|
||||
}
|
101
Wiki/Computing Projects.md
Normal file
101
Wiki/Computing Projects.md
Normal file
|
@ -0,0 +1,101 @@
|
|||
### Software
|
||||
|
||||
#### Ebuilds
|
||||
- [X] try to add my own repository
|
||||
- [X] make xray
|
||||
- [n] make fasd
|
||||
|
||||
####System
|
||||
|
||||
- [n] Install mopidly to have bettr music
|
||||
- [n] change sysklogd to sth that is actually good
|
||||
- [X] configure kernel
|
||||
- [X] acp support
|
||||
- [X] make a little wofi menu to logout, lock, reboot or sth else
|
||||
- [X] and map a key to sway
|
||||
|
||||
####NeoVim
|
||||
|
||||
- [X] Rice and configure neovim
|
||||
- [X] set up nvim start screen
|
||||
- [X] add wiki to entry and remove global MRU
|
||||
- [f] set up CtrlP
|
||||
- [X] set up vimwiki to only work in .wiki
|
||||
- [X] set up terminal in neovim
|
||||
- [X] learn and use bookmarks
|
||||
- [X] setup coc right
|
||||
- [f] learn to disable coc floating
|
||||
- [X] dont use enter to select candidate.
|
||||
- [n] (not needed)make coc complete dotfiles with low priority.
|
||||
|
||||
#### Ricing
|
||||
|
||||
- [n] Rice neomutt
|
||||
- [X] vi keybind for windows for sway.
|
||||
- [X] rice lf
|
||||
- [n] remove preview if is binary
|
||||
- [X] more info
|
||||
- [X] setup shortcuts
|
||||
- [X] quick del
|
||||
- [X] copy as argument
|
||||
- [X] find a way to bulk rename
|
||||
- [f] (cant do that.)set up zsh vimode right.
|
||||
- [X] try iceberg theme system-wide.
|
||||
- [X] change zsh completion prompt red to blue.
|
||||
- [X] wofi
|
||||
- [X] waybar
|
||||
- [X] sway
|
||||
- [X] kitty
|
||||
- [X] zathura
|
||||
- [X] background
|
||||
- [X] tmux
|
||||
|
||||
#### Desktop
|
||||
|
||||
- [n] try alacritty
|
||||
- [X] replace fcitx5 with sth that actually works.
|
||||
- [X] delete it
|
||||
- [X] use ibus or fcitx instead
|
||||
- [X] try to pause mpd when earphone unplug.
|
||||
- [n] map a keybinding to control mpd .
|
||||
- [X] try wl-clip to manage clipboard from cli.
|
||||
|
||||
#### Others
|
||||
|
||||
- [ ] configure chinese input in latex.
|
||||
- [X] mpv scripts
|
||||
- [n] change minimal length to fetch subtitle
|
||||
- [n] try glsl shader [link](https://github.com/bloc97/Anime4K/blob/master/GLSL_Instructions.md)
|
||||
- [n] try swaybar
|
||||
- [X] address the fingerprint issue
|
||||
- [X] install archlinux in VM for software testing.
|
||||
- [X] install bb-aalib
|
||||
- [X] Find a way to download music [Music](Music List)
|
||||
- [ ] ..and import music from walkman
|
||||
- [n] find an pip alternative
|
||||
- [X] write a script to cleanup logs and histfiles
|
||||
- [X] clean system cache
|
||||
- [X] clean userspace cache
|
||||
- [X] try fasd
|
||||
- [X] optimize it.
|
||||
- [X] list why I added repositories
|
||||
- [X] learn Task Warrior.
|
||||
- [f] (not possible) add an alias to build software with optimization
|
||||
- [n] (will conflict)<a-hjkl> to switch windows in tmux
|
||||
- [X] find out whats going on with my mpd.
|
||||
- [n] (I dont want to..) set up cron job to refresh newsboat in the bg
|
||||
- [f] (require wl-keyboard bloat.) try to pipe output into clipboard
|
||||
|
||||
#### Kernel
|
||||
|
||||
- [X] add acpi support
|
||||
- [X] add acp in alsa
|
||||
- [X] check if i have hardware accel in kernel
|
||||
- [X] enable timer-stats module to use powertop
|
||||
- [X] add usb fat support
|
||||
|
||||
#### VimWiki
|
||||
|
||||
- [X] list my software
|
||||
- [X] list why I added repos
|
||||
- [n] complete the vim plugin wiki
|
63
Wiki/Learnings.md
Normal file
63
Wiki/Learnings.md
Normal file
|
@ -0,0 +1,63 @@
|
|||
### Things im interested
|
||||
- [ ] Python
|
||||
- [ ] C
|
||||
- [x] Lua
|
||||
- [x] Bash
|
||||
- [ ] Dancing
|
||||
|
||||
### NeoVim
|
||||
- [ ] learn to debug in nvim-dap
|
||||
- [ ] learn to use [] etc.
|
||||
- [ ] learn basics
|
||||
- [ ] usr_01
|
||||
- [ ] usr_02
|
||||
- [ ] usr_03
|
||||
- [ ] usr_04
|
||||
- [x] usr_05 setting options
|
||||
- [ ] usr_06
|
||||
- [x] usr_07 editing multiple files
|
||||
- [x] usr_08 spliting windows
|
||||
- [x] usr_09 gui guide, not needed.
|
||||
- [x] usr_10 advanced usage.
|
||||
- [x] usr_11 recovering
|
||||
- [x] usr_12 usefil tricks
|
||||
- [x] learn sandwich
|
||||
- [x] learn coc
|
||||
- [x] learn coc snippets
|
||||
- [x] learn md-tables
|
||||
- [x] learn spliting screens
|
||||
- [x] learn tabular
|
||||
- [x] learn vim-fugitive
|
||||
- [x] (I dont need this)write auto script to remove trailing spaces
|
||||
- [x] use easymotion for one window but all range.
|
||||
|
||||
### Coding
|
||||
- [ ] Learn Coding.
|
||||
- [x] play code game at [awesome games](https://github.com/michelpereira/awesome-games-of-coding)
|
||||
- [x] Learn basic C coding.
|
||||
- [x] Learn shell scripting.
|
||||
|
||||
### software
|
||||
- [x] address the GIMP problem
|
||||
- [x] learn write ebuild
|
||||
- [ ] sed
|
||||
- [ ] awk
|
||||
- [x] cut
|
||||
- [x] shell substitution
|
||||
- [x] find
|
||||
- [x] tmux
|
||||
|
||||
### General Computing
|
||||
- [ ] Learn Hacking
|
||||
- [x] check out iyouport
|
||||
- [ ] hack the box
|
||||
- [x] wargames
|
||||
- [x] try centralize the colorscheme config for easy color change
|
||||
|
||||
### Writing and Reading
|
||||
- [ ] learn to write in latex.
|
||||
- [ ] Learn Japanese.
|
||||
|
||||
### Living
|
||||
- [ ] Learn to make food
|
||||
- [ ] salad
|
6
Wiki/Life.md
Normal file
6
Wiki/Life.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
- [f] find a travel destination (or maybe)
|
||||
- [x] get a SIM card
|
||||
- [x] get a Visa card.
|
||||
- [x] and also a chinese credit card using QRcode from BUPT
|
||||
- [x] read manga
|
||||
- [x] beastars
|
4
Wiki/Minecraft.md
Normal file
4
Wiki/Minecraft.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
-[ ] quark
|
||||
-[ ] dungeon crawl
|
||||
-[ ] sodium and iris
|
||||
-[ ] terralith
|
17
Wiki/Neovim-overlay Migration.md
Normal file
17
Wiki/Neovim-overlay Migration.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
### steps
|
||||
|
||||
1. new init.lua
|
||||
|
||||
Dir structure:
|
||||
init.lua
|
||||
lua/
|
||||
core.lua
|
||||
mappings.lua
|
||||
packer.lua
|
||||
plugins/
|
||||
|
||||
2. set global settings.
|
||||
3. packer to manage plugins
|
||||
4. package settings
|
||||
* [link to plugins i use](Vim Plugins)
|
||||
* color settings using nvim-base16
|
8
Wiki/Notes for CS.md
Normal file
8
Wiki/Notes for CS.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
1. use ```int arr[][Columns]``` for 2-d function declaration
|
||||
2. ```#pragma gcc optimize("Ofast, inline")``` to increase speed
|
||||
3. use parens to close bitwise operations and %
|
||||
4. remember the scope in loops (int i) (int j)
|
||||
5. ```matrix[i][j]``` in scanning a 2d array.
|
||||
6. figure out ```matrix[i][j]``` and ```matrix[i][n-1]```
|
||||
|
||||
More can be found in another file.
|
49
Wiki/Repositories.md
Normal file
49
Wiki/Repositories.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
## Enabled 3rd party repos
|
||||
|
||||
1. crocket-overlay
|
||||
2. gentoo-zh
|
||||
3. guru
|
||||
4. lto-overlay
|
||||
5. mv
|
||||
6. tlp
|
||||
7. local
|
||||
|
||||
### Software listing
|
||||
|
||||
1. crocket-overlay
|
||||
* some cosmetic things
|
||||
- nerd-fonts-symbols
|
||||
|
||||
2. gentoo-zh
|
||||
* for fcitx5
|
||||
- fcitx5
|
||||
- fcitx5-gtk
|
||||
- fcitx5-rime
|
||||
- xcb-imdkit
|
||||
|
||||
3. guru
|
||||
- materia theme
|
||||
- wofi
|
||||
- wob
|
||||
- wlsunset
|
||||
- wev
|
||||
- lf
|
||||
|
||||
4. lto-overlay
|
||||
* For Gentoo-lto
|
||||
- ltoize
|
||||
|
||||
5. mv
|
||||
* some patched packages for gentoo-lto
|
||||
- gtk+-2.24.33
|
||||
- man-0-r4
|
||||
- freedesktop-icon-theme
|
||||
- pipewire-0.3.32
|
||||
- lto-rebuild
|
||||
|
||||
6. tlp
|
||||
- tlp
|
||||
|
||||
7. local
|
||||
* my local ebuilds
|
||||
- xray
|
165
Wiki/Software Index.md
Normal file
165
Wiki/Software Index.md
Normal file
|
@ -0,0 +1,165 @@
|
|||
## Installed Packages
|
||||
|
||||
### System-wide
|
||||
|
||||
#### Development
|
||||
* glade
|
||||
* to design gtk apps
|
||||
* libXres
|
||||
* to use gamescope
|
||||
* online-judge-tools(pip)
|
||||
* Grind
|
||||
|
||||
#### Games
|
||||
* SuperTuxKart
|
||||
|
||||
#### Command Line Productivity
|
||||
* ripgrep
|
||||
* quickly search thru dirs
|
||||
* z
|
||||
* replacement of fasd
|
||||
* nnn(locally)
|
||||
* file manager
|
||||
* entr
|
||||
* watch for file change
|
||||
|
||||
#### Mail
|
||||
* Thunderbird
|
||||
|
||||
#### Video and audio
|
||||
* xdg-desktop-portal
|
||||
* for use with screencasting
|
||||
* rtkit
|
||||
* for better dbus support
|
||||
* ofono
|
||||
* for better bluetooth conection
|
||||
* obs
|
||||
* for test streaming
|
||||
* wlrobs
|
||||
* wayland plugin
|
||||
|
||||
#### System
|
||||
* android-tools
|
||||
* to use adb fastboot ... etc
|
||||
* ncurses-compta
|
||||
* to make lineageOS
|
||||
* v4l2loopback
|
||||
* to loopback webcam into a device
|
||||
* wine
|
||||
* Fuck tencent, i hate chinese proprietary shitware.
|
||||
* winetricks
|
||||
* I hate wine and tencent.
|
||||
* wf-recorder
|
||||
* record screen
|
||||
* tree
|
||||
* to show things in a tree
|
||||
|
||||
#### Softwares
|
||||
* imv
|
||||
* for image viewing
|
||||
* fzf
|
||||
* fuzzy searcher ytfzf
|
||||
* wf-recorder
|
||||
* to record things
|
||||
|
||||
#### Coding
|
||||
* gdb
|
||||
* for debugging in neovim
|
||||
* ltrace
|
||||
* for reverse engineering
|
||||
* repo
|
||||
* to sync android tree
|
||||
* luaformatter
|
||||
* to format lua code
|
||||
* prettier
|
||||
* to format web code
|
||||
|
||||
#### Text Editing
|
||||
* pandoc
|
||||
* for word processing
|
||||
* texlive
|
||||
* for word processing
|
||||
* latexmk
|
||||
* for vim latex support
|
||||
* ctags
|
||||
* for vieving tags in vim
|
||||
* libreoffice
|
||||
* for vieving and editing doc files
|
||||
* wl-clipboard
|
||||
* to use copy and paste in cli
|
||||
* fcitx5
|
||||
* to use chinnnese input.
|
||||
* fcitx5-gtk
|
||||
* fcitx5-rime
|
||||
|
||||
#### Info
|
||||
* powertop
|
||||
* for battery stat
|
||||
* radeontop
|
||||
* to see gpu usage
|
||||
* bat
|
||||
* for better cat
|
||||
* eix
|
||||
* for emerge managament
|
||||
* mediainfo
|
||||
* for viewing media info.
|
||||
* ncdu
|
||||
* to view disk usage
|
||||
* iotop
|
||||
* to see disk io
|
||||
|
||||
#### Cosmetic
|
||||
* dejavu
|
||||
* for better font
|
||||
* Symbols-2048-em Nerd Font Complete.ttf (locally)
|
||||
* for nerd icon
|
||||
* geteltorito
|
||||
* for flashing bios image
|
||||
|
||||
#### Pentesting
|
||||
* cracklib-words
|
||||
* wordlist
|
||||
* lynis
|
||||
* to analyze vuls
|
||||
* nmap
|
||||
* to scan ports
|
||||
* aide
|
||||
* to check file integrity
|
||||
* arp-scan
|
||||
* to scan local network.
|
||||
* openVPN
|
||||
* to access THM machines.
|
||||
* whois
|
||||
* to query domain status
|
||||
|
||||
### Local
|
||||
* cxxmatrix
|
||||
* cool matrix effects.
|
||||
* gamescope
|
||||
* RSR for steam games
|
||||
|
||||
### Pip (I hate this)
|
||||
* pip-autoremove
|
||||
* to remove pip software
|
||||
* subilminal
|
||||
* to download subs using mpv scripts
|
||||
* flask_session
|
||||
* flask web development
|
||||
* sqlformat
|
||||
* to format sql code
|
||||
* pipreqs
|
||||
* automatically generate requirements.txt
|
||||
* pmbootstrap
|
||||
* postmarketOS development
|
||||
|
||||
### npm
|
||||
* neovim
|
||||
* for npm support
|
||||
|
||||
### go
|
||||
* go buster
|
||||
* for brute-force URLs
|
||||
|
||||
### Cargo
|
||||
* zeta-note
|
||||
* lsp for markdowm
|
49
Wiki/Vim Plugins.md
Normal file
49
Wiki/Vim Plugins.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
### Core Functionality
|
||||
- [x] lualine.nvim
|
||||
- [x] packer.nvim
|
||||
- [x] neoformat
|
||||
- [x] nvim-tree.lua
|
||||
- [x] telescope.nvim
|
||||
- [x] gitsigns.nvim
|
||||
- [x] nvim-autopairs
|
||||
- [x] vim-matchup
|
||||
- [x] nvim-comment
|
||||
- [x] vimwiki
|
||||
- [x] vim-sandwich
|
||||
- [x] emmet-vim
|
||||
|
||||
### Theming
|
||||
|
||||
#### eye-candy
|
||||
- [x] indent-blankline
|
||||
- [x] nvim-cursorline
|
||||
- [x] nvim-web-devicons
|
||||
- [ ] barbar.nvim
|
||||
|
||||
#### colorscheme
|
||||
##### Opt. 1: use colorscheme
|
||||
- [ ] tokyonight.nvim
|
||||
- [ ] iceberg.vim
|
||||
##### Opt. 2: use colorscheme builder
|
||||
- [x] nvim-base16 (not the one in nvchap)
|
||||
|
||||
### LSP stuff
|
||||
- [x] nvim-lspconfig
|
||||
- [x] nvim-lsp-installer
|
||||
- [ ] lspkind-nvim
|
||||
- [x] nvim-treesitter
|
||||
- [x] integrate this properly.
|
||||
- [x] coq_nvim (better nvim-cmp (nvim-compe is deprecated))
|
||||
- [ ] trouble.nvim
|
||||
- [ ] navigator.lua
|
||||
|
||||
### Git stuff
|
||||
- [x] gitsigns.nvim
|
||||
- [x] vim-fugitive
|
||||
|
||||
### utils
|
||||
- [ ] mkdir.nvim
|
||||
- [x] hop.nvim
|
||||
- [x] configuration
|
||||
- [ ] train.nvim
|
||||
- [x] nvim-ts-rainbow
|
30
Wiki/Wiki-Index.md
Normal file
30
Wiki/Wiki-Index.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
```
|
||||
__ _
|
||||
/\ \ \___ | |_ ___ ___
|
||||
/ \/ / _ \| __/ _ \/ __|
|
||||
/ /\ / (_) | || __/\__ \
|
||||
\_\ \/ \___/ \__\___||___/
|
||||
```
|
||||
|
||||
## To-Do
|
||||
|
||||
==Important: Update this wiki when I have time==
|
||||
|
||||
### [Learnings](Learnings)
|
||||
### [Life](Life)
|
||||
### [Computing Projects](Computing%20Projects)
|
||||
|
||||
## Software Listings
|
||||
|
||||
### [Software\ Index](Software%20Index)
|
||||
### [Vim Plugins](Vim%20Plugins)
|
||||
### [Repositories](Repositories)
|
||||
|
||||
## Projects
|
||||
|
||||
### [Neovim-overlay Migration](Neovim-overlay%20Migration)
|
||||
### [Notes for CS](Notes%20for%20CS)
|
||||
|
||||
## Others
|
||||
|
||||
### [Minecraft](Minecraft)
|
BIN
_files/Pasted image 20220613125739.png
Normal file
BIN
_files/Pasted image 20220613125739.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
3
_templates/Generic Header.md
Normal file
3
_templates/Generic Header.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# {{title}}
|
||||
|
||||
#### {{date}} {{time}}
|
35
_templates/OJ Problem Notes.md
Normal file
35
_templates/OJ Problem Notes.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# {{title}}
|
||||
|
||||
#### {{date}} {{time}}
|
||||
|
||||
---
|
||||
##### Algorithms:
|
||||
#algorithm
|
||||
##### Data structures:
|
||||
#DS
|
||||
##### Difficulty:
|
||||
#<CHANGE_ME> #coding_problem #difficulty-easy
|
||||
##### Related topics:
|
||||
```expander
|
||||
tag:#<INSERT_TAG_HERE>
|
||||
```
|
||||
|
||||
|
||||
|
||||
##### Links:
|
||||
- [Link to problem]()
|
||||
___
|
||||
### Problem
|
||||
|
||||
#### Examples
|
||||
```markdown
|
||||
```
|
||||
|
||||
#### Constraints
|
||||
|
||||
### Thoughts
|
||||
|
||||
> [!summary]
|
||||
> This is a #template_remove_me
|
||||
|
||||
### Solution
|
29
_templates/cpp_stuff_explainer.md
Normal file
29
_templates/cpp_stuff_explainer.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# {{title}}
|
||||
|
||||
#### {{date}} {{time}}
|
||||
|
||||
___
|
||||
##### Algorithms:
|
||||
#algorithm
|
||||
##### Data structures:
|
||||
#DS
|
||||
##### Difficulty:
|
||||
#CS_analysis #difficulty-
|
||||
##### Related problems:
|
||||
```expander
|
||||
tag:#coding_problem tag:#<CHANGE_ME> -tag:#template_remove_me
|
||||
```
|
||||
|
||||
|
||||
##### Links:
|
||||
- [cppreference]()
|
||||
___
|
||||
|
||||
### What is {{title}}?
|
||||
|
||||
### How does {{title}} work?
|
||||
|
||||
#### Example code
|
||||
|
||||
### Why and when to use it?
|
||||
#template_remove_me
|
Loading…
Reference in a new issue