Skip to content

Instantly share code, notes, and snippets.

View ufo22940268's full-sized avatar
🎯
Focusing

Chao Cheng ufo22940268

🎯
Focusing
View GitHub Profile
//Implement the BSTIterator class that represents an iterator over the in-order
//traversal of a binary search tree (BST):
//
//
// BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. Th
//e root of the BST is given as part of the constructor. The pointer should be ini
//tialized to a non-existent number smaller than any element in the BST.
// boolean hasNext() Returns true if there exists a number in the traversal to t
//he right of the pointer, otherwise returns false.
// int next() Moves the pointer to the right, then returns the number at the poi
//Given an array of non-negative integers nums, you are initially positioned at
//the first index of the array.
//
// Each element in the array represents your maximum jump length at that positio
//n.
//
// Determine if you are able to reach the last index.
//
//
// Example 1:
//Given two strings s and p, return an array of all the start indices of p's ana
//grams in s. You may return the answer in any order.
//
//
// Example 1:
//
//
//Input: s = "cbaebabacd", p = "abc"
//Output: [0,6]
//Explanation:
DROP TABLE IF EXISTS users;
CREATE TABLE users
(
id bigint AUTO_INCREMENT PRIMARY KEY,
nick_name varchar(20)
);
CREATE TABLE users2
(
id bigint AUTO_INCREMENT PRIMARY KEY,
<html>
<head>
<style>
.banner {
height: 300px;
background: aquamarine;
}
</style>
</head>
<body>
TestingLibraryElementError: Unable to find an element by: [data-tn="mlsSearchFilters-descWithCodeTypeaheadCheckbox"]
<body>
<div>
<div
aria-expanded="false"
aria-haspopup="listbox"
aria-labelledby="downshift-0-label"
class="uc-descWithCodeTypeahead"
WITH orders AS (
SELECT review, channel, t.product._id pid, t.product.martspec, t.product.costprice, t.product.price, "create"
FROM (SELECT * FROM db_orders WHERE "create" BETWEEN timestamp '2020-11-01 00:00:00' AND timestamp '2020-11-30 23:59:00' AND paid = TRUE) orders
CROSS JOIN unnest(products) AS t(product)
)
-- 2018-03-21 12:29:05
, reviews AS (
SELECT r.name reviewName, c.name channelName, m._id mid, r._id rid
FROM db_reviews r
//A message containing letters from A-Z is being encoded to numbers using the fo
//llowing mapping:
//
//
//'A' -> 1
//'B' -> 2
//...
//'Z' -> 26
//
//
let inputs = [1, 4, 2, 7, 5]
function quickSortImpl(nums, pivot) {
if (nums.length == 0) {
return []
}
return [...quickSortImpl(nums.filter(n => n < nums[pivot]), 0), nums[pivot], ...quickSortImpl(nums.filter((n, i) => n >= nums[pivot] && i != pivot), 0)]
}
//Invert a binary tree.
//
// Example:
//
// Input:
//
//
// 4
// / \
// 2 7