2014年2月25日
摘要: Evaluate Reverse Polish Notation2014.2.25 23:42Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*"] -> (( 阅读全文
posted @ 2014-02-25 23:53 zhuli19901106 阅读(196) 评论(0) 推荐(0)
摘要: Edit Distance2014.2.25 23:07Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) Insert a characterb) Delete a characterc) Replace a characterSolution1: This i. 阅读全文
posted @ 2014-02-25 23:39 zhuli19901106 阅读(193) 评论(0) 推荐(0)
摘要: Clone Graph2014.2.25 22:15Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use#as a separator for each node, and,as a separator for node label and each neighbor of the node.As an example, 阅读全文
posted @ 2014-02-25 22:58 zhuli19901106 阅读(280) 评论(0) 推荐(0)
摘要: Candy2014.2.25 21:34There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least one candy.Children with a higher rating get more candies than their neighbors.What is the mi 阅读全文
posted @ 2014-02-25 22:11 zhuli19901106 阅读(209) 评论(0) 推荐(0)
摘要: 3Sum Closest2014.2.25 19:02Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, and target = 1. ... 阅读全文
posted @ 2014-02-25 21:16 zhuli19901106 阅读(296) 评论(2) 推荐(0)