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 validateCronExpression(input) { | |
const segment = '(\\*|(T|\\*\\/[1-9][0-9]*|(T)(-(T))?)(,(T|\\*\\/[1-9][0-9]*|(T)(-(T))?))*)'; | |
const minute = segment.replaceAll('T', '[0-5]?[0-9]'); | |
const hour = segment.replaceAll('T', '[0-1]?[0-9]|2[0-3]'); | |
const dayOfMonth = segment.replaceAll('T', '[1-9]|[12][0-9]|3[01]'); | |
const month = segment.replaceAll('T', '[1-9]|1[0-2]'); | |
const dayOfWeek = segment.replaceAll('T', '[0-6]'); | |
const cronRegex = new RegExp(`^${minute}\\s+${hour}\\s+${dayOfMonth}\\s+${month}\\s+${dayOfWeek}$`); | |
return cronRegex.test(input); | |
} |
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
{ | |
"台灣": { | |
"臺北市": { | |
"中正區": { | |
"postalCode": "100", | |
"longitude": "121.5198839", | |
"latitude": "25.03240487" | |
}, | |
"大同區": { | |
"postalCode": "103", |
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
const gcd = (a, b) => b ? gcd(b, a % b) : a | |
const p = 61n | |
const q = 53n | |
const n = p * q | |
const r = (p - 1n) * (q - 1n) | |
let e = 1n |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println(fibonacci1(10)) // 55 | |
fmt.Println(fibonacci2(10)) // 55 | |
fmt.Println(fibonacci3(10)) // 55 |
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
/** | |
* Return true if $a is not TRUE. | |
*/ | |
echo "\n".'- Not -'."\n"; | |
var_dump(! 0); // true | |
var_dump(! false); // true | |
var_dump(! null); // true | |
var_dump(! ''); // true | |
var_dump(! []); // true |
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 Node(object): | |
def __init__(self, data): | |
self.data = data | |
self.left = None | |
self.right = None | |
def insert(self, data): | |
if self.data == data: | |
return False | |
elif data < self.data: |
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 Node(object): | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
class LinkedList: | |
def __init__(self): | |
self.head = None | |
self.tail = None | |
def is_empty(self): |