Luna's Blog

「恰似天地一蜉蝣」

CPSC340 Clustering

clustering input: a set of examples described by features $x_i$ output: an assignment of examples to groups K-Means The most popular clustering method Input: the number of clusters hyper...

Genki 1 - Lesson 9 Grammar

Past Tense Short Forms Verbs: past tense affirmative, compare with て form past tense negative, compare with short negative form (ない → なかった) Adjs: past tense affirmative, い adj...

Two Pointer

Fast & Slow Pointers Template Sample Problems: Leetcode 26 Remove Duplicates from Sorted Array Leetcode 80 Remove Duplicates from Sorted Array I...

Leetcode Progress Summary

DP 70. Climbing Stairs 746. Min Cost Climbing Stairs 1137. N-th Tribonacci Number nums[i] = nums[i-1] + nums[i-2] + nums[i-3] 338. Counting Bits p(x+b) = p(x)...

Substring Problems in Leetcode - Prefix Sum

Prefix-sum can solve many sub-array sum problems. We can maintain the sum of array[0:i] to solve this kind of problems. What is Prefix-Sum? preSum[i] is the sum of nums[0:i-1]. If we want the su...

Genki 1 - Lesson 8 Grammar 2

ないでください Please don`t Verb(Short,negative) + ないでください  Please don`t ここの写真をとらないでください。 Compare with てはいけません この部屋に入ってもいいですか。 入らないでください。 VS  入ってはいけません。 Verbのがすきです・上手です ...

CPSC340 Training Error VS Testing Error VS Validation Error

Overfitting Overfitting: lower accuracy on new data The test data cannot influence the training phase in any way. If we use test data during training, then we are overfitting. IID Assumption IID...

CPSC 340 Decision Trees

Decision Trees are simple proagrams consisting of: A nested sequence of “if-else” decisions (splitting rules) A class lable as return value Example: Decision Stump Decision Stump – A sim...

Substring Problems in Leetcode - Sliding Window

Contents Contents Some Sample Problems Leetcode 3: Find Longest Substring without Repeat Chars Similar Problems with Leetcode 3 ...

153. Find Minimum in Rotated Sorted Array

Leetcode 153 Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it w...