LeetCode Brick Wall There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to the bottom and cross the least... Read More

# Monthly Archives: May 2017

# LeetCode Subarray Sum Equals K

LeetCode Subarray Sum Equals K Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = , k = 2 Output: 2 Note: The length of the array is in range . The... Read More

# LeetCode Subtree of Another Tree

LeetCode Subtree of Another Tree Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The... Read More

# LeetCode Can I Win

LeetCode Can I Win In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins. What if we change the game so that players cannot re-use... Read More

# LeetCode Predict the Winner

LeetCode Predict the Winner Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number... Read More

# LeetCode Friend Circles

LeetCode Friend Circles There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, then A is an indirect friend of... Read More

# LeetCode Distribute Candies

LeetCode Distribute Candies Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these candies equally in... Read More

# LeetCode Reshape the Matrix

LeetCode Reshape the Matrix In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. You're given a matrix represented by a two-dimensional array, and two... Read More

# hihoCoder 1519-逃离迷宫II

hihoCoder 1519-逃离迷宫II #1519 : 逃离迷宫II 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi被坏女巫抓进里一间有N x... Read More

# hihoCoder 1518-最大集合

hihoCoder 1518-最大集合 #1518 : 最大集合 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个1-N的排列A, A, ... A，定义集合S = {A, A], A]] ...... Read More