1 + 2 + 3 + 4 + … +n

From [1]

Sum of 1 + 1/2 + 1/4 +… + 1/(2^(i-1))


Dataset

import torch
from torch.utils.data import Dataset
from torchvision import datasets
from torchvision.transforms import ToTensor
import matplotlib.pyplot as plt


training_data = datasets.FashionMNIST(
root="data",
train=True,
download=True,
transform=ToTensor()
)

FashionMNIST source code


Problem

1857. Largest Color Value in a Directed Graph

Explanation


209. Minimum Size Subarray Sum

class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int i = 0, j = 0;
const int n = nums.size();
int ret = n + 1;
for (int j = 0; j < n; ++j) {
// update the nums to prefix_sum…


My questions

What is stack?


A      (4d array):  8 x 1 x 6 x 5
B (3d array): 7 x 1 x 5
Result (4d array): 8 x 7 x 6 x 5

const int INF = 1e9;
struct Query{
int id, prefered, minSize;
// Line 1…

Explanation

Complexity



Illustrated by Jimmy Shen
typedef long long LL;
class MKAverage {
public:
struct Range {
multiset<int> s;
LL sum = 0;
void insert(int x) {
s.insert(x);
sum += x;
}
void remove(int x) {…

Jimmy Shen

Data Scientist/MLE/SWE @takemobi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store