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
bind TAB:menu-complete | |
bind "\C-H":shell-backward-kill-word | |
bind "\e[3;5~":shell-kill-word |
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
function Convert-PdfToGif($pdfpath) { | |
$pdf = Get-Item $pdfpath | |
$name = $pdf.BaseName | |
pdftoppm -png "$($pdf.FullName)" $name | |
$pngs = Get-ChildItem "$name-*.png" | |
$num = [math]::Ceiling([math]::Log10($pngs.Length + 1)) |
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
// BFS | |
class Node { | |
int row; | |
int col; | |
int step; | |
Node(int row, int col, int step) { | |
this.row = row; | |
this.col = col; | |
this.step = step; |
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
class Solution { | |
public List<List<String>> groupAnagrams(String[] strs) { | |
if (strs.length == 0) return new ArrayList(); | |
Map<String, List> ans = new HashMap<String, List>(); | |
for (String s : strs) { | |
char[] ca = s.toCharArray(); | |
Arrays.sort(ca); | |
String key = String.valueOf(ca); | |
if (!ans.containsKey(key)) ans.put(key, new ArrayList()); | |
ans.get(key).add(s); |
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
# https://leetcode.com/problems/product-of-array-except-self/description/ | |
# Runtime 219 ms Beats 96.61% Memory 21.1 MB Beats 95.12% | |
class Solution: | |
def productExceptSelf(self, nums: List[int]) -> List[int]: | |
zeroes = set() | |
prod = 1 | |
for i, x in enumerate(nums): |
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
class BSTIterator { | |
Stack<TreeNode> stack; | |
public BSTIterator(TreeNode root) { | |
this.stack = new Stack<TreeNode>(); | |
this._leftmostInorder(root); | |
} | |
private void _leftmostInorder(TreeNode root) { |
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
// Java program to check if two strings | |
// areIsomorphic | |
import java.io.*; | |
import java.util.*; | |
class GFG { | |
static boolean areIsomorphic(String str1, String str2) | |
{ |
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
// https://www.geeksforgeeks.org/lexicographically-smallest-string-possible-by-using-given-operations/ | |
// Given a string S consisting of digits from 0 to 9 inclusive, the task is to form the lexicographically | |
// smallest string by performing an operation any number of times. In one operation you can choose any | |
// position i and delete the digit d at s[i] and insert min(d+1, 9) on any position (at the beginning, | |
// at the end, or in between any two adjacent digits). | |
import java.io.*; | |
import java.util.*; | |
import java.util.PriorityQueue; | |
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
cd $env:APPDATA\Code\User | |
Get-ChildItem .\profiles\ | % { copy .\keybindings.json "$_\keybindings.json" } |
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
// ==UserScript== | |
// @name Copy Job Description | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Adds a "Copy Job Description" button to amazon.jobs listing | |
// @author sharunkumar | |
// @match https://www.amazon.jobs/en/jobs/*/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.jobs | |
// @grant none | |
// ==/UserScript== |