This file contains hidden or 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> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://code.jquery.com/jquery.min.js"></script> | |
| <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> | |
| <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> |
This file contains hidden or 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
| const busyStudent = (startTime, endTime, queryTime) => { | |
| let count = 0; | |
| // Iterate through the length of startTime. | |
| for (i in startTime) { | |
| // Increment count for each matching pair where startTime >= queryTime <= endTime. | |
| count += queryTime >= startTime[i] && queryTime <= endTime[i] ? 1 : 0; | |
| } | |
| return count; |
This file contains hidden or 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
| const removeDigit = (number, digit) => { | |
| let max = 0; | |
| index = number.indexOf(digit); | |
| while (index != -1) { | |
| left = number.substring(0, index); | |
| right = number.substring(index+1); | |
| value = left + right; | |
| const n = BigInt(value); |
This file contains hidden or 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: | |
| def maxTurbulenceSize(self, arr: List[int]) -> int: | |
| # O(n) | |
| max_length = 1 | |
| is_greater = None | |
| cur_length = 1 | |
| for i in range(len(arr) - 1): | |
| # Compare the current and next array values. | |
| s0 = arr[i] |
This file contains hidden or 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: | |
| def alternatingSubarray(self, nums: List[int]) -> int: | |
| # Combination search O(n^2). | |
| max_length = -1 | |
| for i in range(len(nums) - 1): | |
| cur_length = 0 | |
| is_odd = True | |
| # Check the subarray of values from i to the end of the array. |
This file contains hidden or 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> | |
| <title>Bank Failures by Year</title> | |
| <!-- Include Bulma CSS --> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"> | |
| </head> | |
| <body> | |
| <section class="section"> | |
| <div class="container"> |
This file contains hidden or 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
| ; | |
| ; AutoIt script to automatically level up a magic spell in Final Fantay II on PSX (PS1). | |
| ; | |
| #include <Constants.au3> | |
| Opt("SendKeyDownDelay", 20) | |
| $count = 10 | |
| ; Wait for the window to become active. | |
| If WinActivate("pSX v1.13") Then |
This file contains hidden or 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 hidden or 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 hidden or 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() { | |
| } |