码迷,mamicode.com
首页 >  
搜索关键字:generate parentheses    ( 3729个结果
[LeetCode] Pascal's Triangle
Pascal's Triangle Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 解题思...
分类:其他好文   时间:2015-05-07 16:50:12    阅读次数:90
LeetCode (29) Fraction to Recurring Decimal
题目描述Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For...
分类:其他好文   时间:2015-05-07 14:32:56    阅读次数:152
[Leetcode][020] Valid Parentheses (Java)
题目在这里:https://leetcode.com/problems/valid-parentheses/【标签】Stack; String【个人分析】这个题应该算是Stack的经典应用。先进后出 ( FILO) 的结构: 先来的左边括号跟后面的右边括号相匹配。【代码解释】创建一个栈,如果遇到的是...
分类:编程语言   时间:2015-05-07 06:26:27    阅读次数:161
【leetcode with java】32 Longest Valid Parentheses O(n)
这个题目leetcode上提示用动态规划,但是那样要O(n^2)。我自己想出了一个O(n)的算法,并提交通过。【题目】Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "((...
分类:编程语言   时间:2015-05-06 11:00:58    阅读次数:123
Leetcode#38Count and Say
Thecount-and-saysequenceisthesequenceofintegersbeginningasfollows:1,11,21,1211,111221,...1isreadoffas"one1"or11.11isreadoffas"two1s"or21.21isreadoffas"one2,thenone1"or1211.Givenanintegern,generatethenthsequence.Note:Thesequenceofintegerswillberepresentedasa..
分类:其他好文   时间:2015-05-05 19:57:10    阅读次数:129
Leetcode#118Pascal's Triangle
Pascal‘sTriangleTotalAccepted:43914TotalSubmissions:145531MySubmissionsQuestionSolutionGivennumRows,generatethefirstnumRowsofPascal‘striangle.Forexample,givennumRows=5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]分析,数据特点是,当前行可由上一行计..
分类:其他好文   时间:2015-05-05 19:56:10    阅读次数:111
LeetCode22 Generate Parentheses 括号生成
题目: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(()...
分类:其他好文   时间:2015-05-05 14:29:11    阅读次数:172
LeetCode 20 Valid Parentheses 括号匹配问题
题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are...
分类:其他好文   时间:2015-05-05 10:35:05    阅读次数:144
leetcode_118题——Pascal's Triangle(简单的数学题)
Pascal's TriangleTotal Accepted:43845Total Submissions:145271My SubmissionsQuestionSolutionGivennumRows, generate the firstnumRowsof Pascal's triangle...
分类:其他好文   时间:2015-05-04 19:29:23    阅读次数:97
【leetcode】Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order.For example,Given n = 3,You should return the followin...
分类:其他好文   时间:2015-05-03 20:36:52    阅读次数:125
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!