题目如图 首先明确的是,可以有(()) ([])诸如此类的表达的。 然后用栈实现算法是,较为容易的。 判断总长度,不是2的倍数,返回false。 如果第一个是)]},返回false。 如果是( [ {则压入栈中 如果是)则看栈顶是不是(,如果不是,那么返回false。其他,类似。 执行完循环,如果栈 ...
分类:
编程语言 时间:
2017-07-02 15:19:40
阅读次数:
218
https://leetcode.com/problems/valid-parentheses/#/solutions ...
分类:
其他好文 时间:
2017-07-02 00:14:23
阅读次数:
170
题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", ...
分类:
编程语言 时间:
2017-07-01 11:58:10
阅读次数:
145
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only ...
分类:
其他好文 时间:
2017-07-01 01:00:31
阅读次数:
275
题目描述 Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat" ...
分类:
其他好文 时间:
2017-06-29 17:24:21
阅读次数:
134
https://leetcode.com/problems/valid-perfect-square/#/solutions ...
分类:
其他好文 时间:
2017-06-29 11:15:00
阅读次数:
143
一、题目 1、描述 2、题意 求满足括号闭合规则的最大子串长度 二、解答 1、思路: 刚开始想到的是前面的判断这个字符串是否满足闭合规则的方法,即建一个Stack,当为'(' 时候,')' 入栈,当为 ')' 时候,判断栈顶是否为 ‘)’, 这种方法未解决 ()(() 这种情况。看到网上大神的方法, ...
分类:
其他好文 时间:
2017-06-26 18:04:47
阅读次数:
154
leetcode 逆波兰式求解 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are+,-,*,/. Each operand may be an integer ...
分类:
其他好文 时间:
2017-06-25 23:52:10
阅读次数:
156
centos7开机无法进入图形界面,出现sda assuming drive cache write through、no valid rapl domains found in package之类信息。 这个问题是我在VMware里面操作出现的,原因是我在使用虚拟机和实体机之间文件共享功能时,ce ...
分类:
系统相关 时间:
2017-06-25 18:40:19
阅读次数:
9628