Instantly share code, notes, and snippets.

🌴
On vacation

🌴
On vacation
Created January 18, 2024 08:58
Solution to Max Median on CF (https://codeforces.com/contest/1486/problem/D)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* Given the constraints in the problem, our algo has to be at most O(n log n). We can acheive this bound using binary search Suppose we have already created a function f(x) which, in O(n) time, can compute whether or not a subarray exists with median greater than (or equal to) x. Then, answering this question becomes as simple as finding the largest value of x such that f(x) is true. Finding this largest value of x can be done in O(log n) time with the method explained below. If the maximum median of a test case is 5, the outputs of f(x) would look something like the following: x: 1 2 3 4 5 6 7 8 9 f(x): T T T T T F F F F
Created October 24, 2023 20:05
CPP keybinds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // Place your key bindings in this file to override the defaultsauto[] [ { "key": "ctrl+enter", "command": "code-runner.run" }, { "key": "ctrl+alt+n", "command": "-code-runner.run" },
Created October 24, 2023 20:03
CPP Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 { // Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // \$1, \$2 for tab stops, \$0 for the final cursor position, and \${1:label}, \${2:another} for placeholders. Placeholders with the // same ids are connected. // Example: // "Print to console": { // "prefix": "log", // "body": [ // "console.log('\$1');",
Last active October 24, 2023 20:02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 { "editor.fontSize": 18, "terminal.integrated.fontSize": 12, "editor.fontFamily": "\"Fira Code Light\", \"Monoid\", \"JetBrainsMono Nerd Font Mono\"", "workbench.colorTheme": "Dare (rainglow)", "code-runner.executorMap": { // "cpp": "cls && cd \$dir && g++ \$fileName -o \"C:\\Users\\ahmad\\OneDrive\\Desktop\\Coding\\IO\\bin\\\$fileNameWithoutExt\" && C:\\Users\\ahmad\\OneDrive\\Desktop\\Coding\\IO\\bin\\\$fileNameWithoutExt C:\\Users\\ahmad\\OneDrive\\Desktop\\Coding\\IO\\output.txt", "cpp": "cls && cd \$dir && g++ \$fileName -o \"C:\\Users\\ahmad\\Desktop\\Coding\\!Workspace\\bin\\\$fileNameWithoutExt\" && C:\\Users\\ahmad\\Desktop\\Coding\\!Workspace\\bin\\\$fileNameWithoutExt C:\\Users\\ahmad\\Desktop\\Coding\\!Workspace\\output.txt" }, "code-runner.runInTerminal": true,
Last active June 28, 2022 10:55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import ( "fmt" "math" ) //Linked list structs type node struct { val int
Last active June 27, 2022 18:15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import( "fmt" "math" ) func main(){ //Input (hardcode values if you are using Go Playground since it doesn't support terminal input) var inputs [2]int