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

    Posts

    • Leetcode 299: Bulls and Cows

      Posted on August 1, 2018

      Question You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret... [Read More]
      Tags:
      • Leetcode
    • Leetcode 298: Binary Tree Longest Consecutive Sequence

      Posted on August 1, 2018

      Question [Read More]
      Tags:
      • Leetcode
    • Leetcode 296: Best Meeting Point

      Posted on August 1, 2018

      Question A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group. The distance is calculated using Manhattan Distance, where distance (p1, p2)... [Read More]
      Tags:
      • Leetcode
      • Hard
    • Leetcode 295: Find Median from Data Stream

      Posted on August 1, 2018

      Question Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. [Read More]
      Tags:
      • Leetcode
      • Hard
      • Review
    • Leetcode 323: Number of Connected Components in an Undirected Graph

      Posted on July 31, 2018

      Question Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected components in an undirected graph. [Read More]
      Tags:
      • Leetcode
      • BFS
    • Leetcode 320: Generalized Abbreviation

      Posted on July 31, 2018

      Question Write a function to generate the generalized abbreviations of a word. [Read More]
      Tags:
      • Leetcode
      • DP
      • Backtracking
    • Leetcode 672: Bulb Switcher II

      Posted on July 31, 2018

      Question There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, you need to return how many different kinds of status of the n lights could be. [Read More]
      Tags:
      • Leetcode
    • Leetcode 319: Bulb Switcher

      Posted on July 31, 2018

      Question There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the i-th round, you toggle every... [Read More]
      Tags:
      • Leetcode
    • Leetcode 318: Maximum Product of Word Lengths

      Posted on July 31, 2018

      Question Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If no such two words exist, return 0. [Read More]
      Tags:
      • Leetcode
    • Leetcode 293: Flip Game

      Posted on July 31, 2018

      Question You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take turns to flip two consecutive "++" into "--". The game ends when a person can no longer make a move and therefore... [Read More]
      Tags:
      • Leetcode
    • Leetcode 289: Game of Life

      Posted on July 31, 2018

      Question According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.” [Read More]
      Tags:
      • Leetcode
    • Leetcode 287: Find the Duplicate Number

      Posted on July 30, 2018

      Question Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. [Read More]
      Tags:
      • Leetcode
      • Review
    • Leetcode 286: Walls and Gates

      Posted on July 30, 2018

      Question You are given a m x n 2D grid initialized with these three possible values. [Read More]
      Tags:
      • Leetcode
      • BFS
    • Leetcode 285: Inorder Successor in BST

      Posted on July 30, 2018

      Question Given a binary search tree and a node in it, find the in-order successor of that node in the BST. [Read More]
      Tags:
      • Leetcode
    • Leetcode 284: Peeking Iterator

      Posted on July 30, 2018

      Question Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation – it essentially peek() at the element that will be returned by the next call to next(). [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