Baihu Qian 钱柏湖
  • Posts
  • Tag Index
  • Search
Navigation bar avatar
✕

    Posts

    • Leetcode 281: Zigzag Iterator

      Posted on July 30, 2018

      Given two 1d vectors, implement an iterator to return their elements alternately. [Read More]
      Tags:
      • Leetcode
    • Leetcode 280: Wiggle Sort

      Posted on July 30, 2018

      Question Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... [Read More]
      Tags:
      • Leetcode
    • Leetcode 279: Perfect Squares

      Posted on July 30, 2018

      Question Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. [Read More]
      Tags:
      • Leetcode
      • BFS
      • Review
    • Leetcode 278: First Bad Version

      Posted on July 29, 2018

      Question You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. [Read More]
      Tags:
      • Leetcode
    • Leetcode 277: Find the Celebrity

      Posted on July 29, 2018

      Question Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her but he/she does not know any of them. [Read More]
      Tags:
      • Leetcode
    • Leetcode 276: Paint Fence

      Posted on July 29, 2018

      Question There is a fence with n posts, each post can be painted with one of the k colors. [Read More]
      Tags:
      • Leetcode
      • DP
      • Review
    • Leetcode 272: Closest Binary Search Tree Value II

      Posted on July 29, 2018

      Question [Read More]
      Tags:
      • Leetcode
      • Hard
    • Breath-First Search

      Posted on July 29, 2018

      Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph), and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth... [Read More]
      Tags:
      • Algorithm
    • Leetcode 207: Course Schedule

      Posted on July 29, 2018

      Question There are a total of n courses you have to take, labeled from 0 to n-1. [Read More]
      Tags:
      • Leetcode
      • TopologicalSort
    • Leetcode 210: Course Schedule II

      Posted on July 29, 2018

      Question There are a total of n courses you have to take, labeled from 0 to n-1. [Read More]
      Tags:
      • Leetcode
      • TopologicalSort
      • Review
    • Topological Sorting

      Posted on July 29, 2018

      Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge (u, v), vertex u comes before v in the ordering. Topological Sorting for a graph is not possible if the graph is not a DAG. The first vertex in topological sorting... [Read More]
      Tags:
      • Algorithm
      • TopologicalSort
    • Depth First Search

      Posted on July 29, 2018

      Depth First Traversal (or Search) for a graph is similar to Depth First Traversal of a tree. The only catch here is, unlike trees, graphs may contain cycles, so we may come to the same node again. To avoid processing a node more than once, we use a boolean visited... [Read More]
      Tags:
      • Algorithm
    • Leetcode 68: Text Justification

      Posted on July 29, 2018

      Question Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. [Read More]
      Tags:
      • Leetcode
      • Hard
    • Leetcode 57: Insert Interval

      Posted on July 29, 2018

      Question Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). [Read More]
      Tags:
      • Leetcode
      • Hard
    • Leetcode 271: Encode and Decode Strings

      Posted on July 28, 2018

      Question Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings. [Read More]
      Tags:
      • Leetcode
    • ← Newer Posts
    • Older Posts →
    • Email me
    • GitHub
    • LinkedIn
    • Instagram

    Baihu Qian  •  2025  •  baihuqian.github.io  •  Edit page

    Powered by Beautiful Jekyll