摘要: In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space. These characters divide the square into contiguous re 阅读全文
posted @ 2018-12-28 23:58 yuxihong 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B a 阅读全文
posted @ 2018-12-28 21:16 yuxihong 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Return any binary tree that matches the given preorder and postorder traversals. Values in the traversals pre and post are distinct positive integers. 阅读全文
posted @ 2018-12-28 16:33 yuxihong 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the k 阅读全文
posted @ 2018-12-28 16:13 yuxihong 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers 阅读全文
posted @ 2018-12-28 15:42 yuxihong 阅读(129) 评论(0) 推荐(0) 编辑
摘要: uppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of th 阅读全文
posted @ 2018-12-28 15:18 yuxihong 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ 阅读全文
posted @ 2018-12-28 14:47 yuxihong 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto 阅读全文
posted @ 2018-12-28 10:44 yuxihong 阅读(183) 评论(0) 推荐(0) 编辑
摘要: There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next r 阅读全文
posted @ 2018-12-28 01:05 yuxihong 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the defin 阅读全文
posted @ 2018-12-28 00:48 yuxihong 阅读(135) 评论(0) 推荐(0) 编辑
摘要: A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p 阅读全文
posted @ 2018-12-28 00:31 yuxihong 阅读(113) 评论(0) 推荐(0) 编辑