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
/** | |
* Definition for a binary tree node. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} original | |
* @param {TreeNode} cloned |
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 class Solution { | |
public int MinOperations(string s) { | |
// Using original first bit. | |
int count1 = 0; | |
char prev1 = s[0]; | |
// Using opposite first bit. | |
int count2 = 1; | |
char prev2 = prev1 == '0' ? '1' : '0'; | |
for (int i=1; i<s.Length; 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
using System.Threading; | |
public class Foo { | |
private static Object _lock = new Object(); | |
private static int _sequence = 0; | |
private int _limit = 100; | |
public Foo() { | |
} |
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 class Solution { | |
public int MinTimeToVisitAllPoints(int[][] points) { | |
int seconds = 0; | |
int cx = points[0][0]; | |
int cy = points[0][1]; | |
for (int i=1; i<points.Length; i++) | |
{ | |
int[] coord = points[i]; | |
int x = coord[0]; |
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
PowerShell -Command "Set-ExecutionPolicy Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1 | |
PowerShell C:\Users\YOUR_USERNAME\Desktop\hotspot-keepalive.ps1 >> "%TEMP%\StartupLog.txt" 2>&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
public class MinStack { | |
private struct Item | |
{ | |
public int Val; | |
public int ParentMin; | |
}; | |
private int _min; | |
private List<Item> _stack; | |
private int _minIndex; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"> | |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
</head> | |
<body onload="countRefreshes()"> | |
<div class="container mt-5"> | |
<div class="card"> |
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 Sudoku { | |
constructor(emptyCellCount = 20) { | |
this.solvedBoard = this.generateSudoku(); | |
this.board = JSON.parse(JSON.stringify(this.solvedBoard)); | |
this.clearCells(emptyCellCount); | |
} | |
clearCells(K) { | |
// Remove K elements randomly to create an 'easy' puzzle | |
for (let i = 0; i < K; 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
// Create a scene | |
var scene = new THREE.Scene(); | |
// Create a camera | |
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); | |
camera.position.z = 5; | |
// Create a renderer | |
var renderer = new THREE.WebGLRenderer(); | |
renderer.setSize(window.innerWidth, window.innerHeight); |
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
# Load the rvest package | |
library(rvest) | |
library(ggplot2) | |
library(tidytext) | |
library(tidyverse) | |
library(topicmodels) | |
library(tm) | |
library(wordcloud) | |
library(RColorBrewer) |