Contents

AlgoExpert Practice (Array)

Two Number Sum

Unfold:

Non-Constructible Change

Unfold:

Three Number Sum

Unfold:
func threeSum(nums []int) [][]int {
    res := [][]int{}
    sort.Ints(nums)
    n := len(nums)
    if n < 3{
        return res
    }
    for i := 0; i < n-2; i++{
        if i > 0 && nums[i] == nums[i-1]{
            continue
        }
        left, right := i+1, n-1
        for left < right{
            sum := nums[i]+nums[left]+nums[right]
            if sum > 0{
                right--
            }else if sum < 0{
                left++
            }else {
                res = append(res, []int{nums[i], nums[left], nums[right]})
                left++
                right--
                for left < right && nums[left] == nums[left-1]{
                    left++
                }
                if left < right && nums[right] == nums[right+1]{
                    right--
                }
            }
        }
    }
    return res
}

Smallest Difference

Unfold:

Move Element to End

Unfold:

Longest Peak

Unfold:

Array of Products

Unfold:

First Duplicate Value

Unfold:

Best Seat

Unfold:

Zero Sum Subarray

Unfold:

Missing Numbers

Unfold:

Majority Element

Unfold:

Sweet and Savory

Unfold:

Longest Streak of Adjacent Ones

Unfold:

Balance Index

Unfold:

Repeated Matrix Values

Unfold:

Subarray Sort

Unfold:

Largest Range

Unfold:

Min Rewards

Unfold:

Zigzag Traverse

Unfold:

Longest Subarray with Sum

Unfold:

Knight Connection

Unfold:

Count Squares

Unfold:

Apartment Hunting

Unfold:

Calendar Matching

Unfold:

Waterfall Streams

Unfold:

Minimum Area Rectangle

Unfold:

Line Through Points

Unfold: