Skip to content
Yu's Blog

Yu's Blog

Welcome to my blog

Tag: Binary Search

Posted on May 23, 2022

Algorithm Pattern – Binary Search

Algorithm Pattern 1 – Find the target element class Solution { public int search(int[] nums, int target) { int left = 0, right = nums.length – 1; while(left <= right){ int mid = left + (right – left) / 2; if(nums[mid] == target){ return mid; } else if(nums[mid] < target){ left = mid + 1; …

Continue reading “Algorithm Pattern – Binary Search”

Posted on July 13, 2020

Longest Increasing Subsequence

This No.300 in LeetCode. Here are two approaches for this problem, I will introduce both of them here. Dynamic Programming – O(n^2) The first solution using Dynamic Programming. We will create a one-dimension dp array. We will go over the whole array, and store the numbers of greater number in dp array. class Solution { …

Continue reading “Longest Increasing Subsequence”

Posted on July 12, 2020

A simple Binary Search Template

def lower_bound(array, first, last, value) # return first !< val in [first, last) while first < last: # not empty mid = first + (last – first)/2. # no overflow if array[mid] < val : first = mid + 1 else: last = mid return first. # or last No need to worry about onverflow: …

Continue reading “A simple Binary Search Template”

CONTACT ME

My GitHub
My LinkedIn

Recent Posts

  • WebSocket in Java
  • Design Patterns – Command Pattern
  • Design Patterns – Decorator Pattern
  • Design Patterns – Iterator Pattern
  • Design Pattern – Repository Design Pattern

Categories

  • Algorithm
  • Android
  • Architecture
  • BlockChain
  • C/C++
  • Cloud
  • Design
  • DevOps
  • Flutter
  • Git
  • Go
  • Java
  • JavaScript
  • Kotlin
  • Mac
  • Machine Learning
  • Networking
  • OS
  • Python
  • Security
  • Server
  • Spring
  • Tool
  • Unity
  • Unreal
  • Vim
  • Windows
  • WordPress

Tags

  • Algorithm
  • AndroidStudio
  • Android Studio
  • Array
  • AWS
  • BackTracking
  • Binary Search
  • Bit Manipulation
  • BST
  • Detached HEAD
  • Docker
  • DynamicProgramming
  • Express
  • Express.js
  • Firebase
  • Flutter
  • git
  • GitHub
  • Google Cloud
  • HashMap
  • Integer
  • Java
  • JavaScript
  • Kotlin
  • Kubernetes
  • LaserDefender
  • LeetCode
  • LinkedList
  • List
  • Mac
  • Node.js
  • OOD
  • OperatingSystem
  • Recursion
  • Server
  • SideProject
  • Sorting
  • Spring
  • Spring Boot
  • String
  • Tree
  • Unity
  • VPS
  • Wechat
  • Windows
March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Feb    

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org