Instantly share code, notes, and snippets.

• Sort options

# Gaurav Kamathst0le

View TwoSum.java
 // If Array was already sorted // Complexity - O(n) private int[] findPair_4(int[] A) { int left = 0, right = A.length - 1; while (left < right) { int s = A[left] + A[right]; if (s == 0) return new int[]{A[left], A[right]}; else if (s > 0) right--;
View keybase.md

### Keybase proof

I hereby claim:

• I am ST0LE on github.
• I am gauravkamath (https://keybase.io/gauravkamath) on keybase.
• I have a public key whose fingerprint is AC20 EC1E 4274 DA5F 32E4 4704 B9C9 97B3 05BE A391

To claim this, I am signing this object:

View Find-FirstItem.ps1
 Function Find-FirstItem { [CmdletBinding()] [Alias("ffi")] param( [Parameter(Mandatory, Position = 0)] [ValidateNotNullOrEmpty()] [string] \$Filter ) Get-ChildItem -Recurse -Filter \$Filter | Select-Object -First 1 -ExpandProperty FullName }
View ThreeSum.java
 // Complexity - O(n^2), Space Complexity - O(n^2) private int[] findTriple_3(int[] A) { Map map = new HashMap(); for (int i = 0, l = A.length; i < l; i++) { map.clear(); for (int j = i + 1; j < l; j++) { if (map.containsKey(A[j])) { int[] pair = map.get(A[j]); return new int[]{pair[0], pair[1], A[j]};
View Systray.cs
 using System; using System.Drawing; using System.Windows.Forms; namespace MyTrayApp { public class SysTrayApp : Form { [STAThread] public static void Main()
View ThreeSum.java
 // Complexity - O(n^2 logn) private int[] findTriple_2(int[] A) { Arrays.sort(A); // O(nlogn) for (int i = 0, l = A.length; i < l && A[i] < 0; i++) { //O(n^2 logn) for (int j = i + 1; j < l && A[i] + A[j] < 0; j++) { int k = Arrays.binarySearch(A, j + 1, l, -A[i] - A[j]); if (k > j) return new int[]{A[i], A[j], A[k]}; } } return null;
View MediaKeys.ahk
View autoexec.cfg
 alias +jumpthrow "+jump;-attack" alias -jumpthrow "-jump" bind mouse3 +jumpthrow bind mouse5 +voicerecord alias +fwdjumpthrow "+forward;+jump;-attack" alias -fwdjumpthrow "-forward;-jump" bind capslock +fwdjumpthrow exec buyscript; alias +djump "+jump; +duck" alias -djump "-jump; -duck"
View huffman.py
 from collections import Counter from heapq import heapify, heappop, heappush s = input() c = Counter(s) pq = [(c[k], k, None, None) for k in c] codes = {} heapify(pq) while len(pq) > 1: r = heappop(pq)
View dsalgo.md