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
goreleaser --rm-dist --skip-validate | |
osascript -e 'tell app "Dock" to quit' |
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
def subsets(a): | |
result = [[]] | |
a = sorted(a) | |
i = 0 | |
while i < len(a): | |
duplicates = 1 | |
while i < len(a) - 1 and a[i] == a[i + 1]: | |
i += 1 | |
duplicates += 1 | |
size = len(result) |
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
#include <vector> | |
#include <iostream> | |
#include <map> | |
#include <tuple> | |
#include <unordered_map> | |
using namespace std; | |
/* | |
* Problem description: https://ibb.co/N2cnXG1 |
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
public static void quicksort(int[] a, int left, int right) { | |
if (left < right) { | |
int p = position(a, left, right); | |
quicksort(a, left, p - 1); | |
quicksort(a, p, right); | |
} | |
} | |
private static int position(int[] a, int left, int right) { | |
int pivot = a[(left + right) / 2]; |
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
cmake_minimum_required(VERSION 3.17) | |
project(FiberTutorial) | |
set(CMAKE_CXX_STANDARD 11) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
FIND_PACKAGE( Boost 1.68 COMPONENTS program_options fiber) | |
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) | |
ADD_EXECUTABLE( test_fiber main.cpp ) |
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 { | |
int[] p; | |
int[] r; | |
int c = 0; | |
public int countComponents1(int n, int[][] edges) { | |
p = new int[n]; | |
r = new int[n]; | |
for (int i = 0; i < n; i++) { | |
p[i] = i; | |
} |
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 { | |
int[] p; | |
int[] r; | |
int c = 0; | |
public int countComponents1(int n, int[][] edges) { | |
p = new int[n]; | |
r = new int[n]; | |
for (int i = 0; i < n; i++) { | |
p[i] = i; | |
} |
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
// merg two sorted arrays in-place | |
int[] arr1 = {1, 5, 9, 11, 15, 20}; | |
int[] arr2 = {2, 3, 8, 13}; | |
for (int i = 0; i < arr1.length; i++) { | |
if (arr1[i] > arr2[0]) { | |
int temp = arr1[i]; | |
arr1[i] = arr2[0]; | |
arr2[0] = temp; |
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
{ | |
"devices":[ | |
{ | |
"cid":"201804170017", | |
"click_disabled":0, | |
"elementType":null, | |
"firmwareVersion":"8.4.0.0-1.0.6.0", | |
"health":"good", | |
"healthReason":[ |
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
public int[][] generateMatrix(int n) { | |
int[][] a = new int[n][n]; | |
int c = 0; | |
int top = 0; | |
int left = 0; | |
int right = n - 1; | |
int down = n - 1; | |
while (left <= right) { | |
for (int j = left; j <= right; j++) { | |
c++; |
NewerOlder