给定一个仅包含 '('、')'、'{'、'}'、'['、']'的字符串,确定输入的字符串是否合法。 e.g. "()"、"()[]{}"、"[()]([]({}))" 是合法的,而"(]"、"([)]" 是不合法的。 使用栈stack C++实现: 对应的Java实现: C++中的stack,其中有 ...
分类:
其他好文 时间:
2017-07-04 20:17:39
阅读次数:
185
盗链是指一个网站的资源(图片或附件)未经允许在其它网站提供浏览和下载。尤其热门资源的盗链,对网站带宽的消耗非常大,本文通过nginx的配置指令location来实现简单的图片和其它类型文件的防盗链。Nginx 的配置文件 : 用 (“|”) 来分隔你想保护的文件的扩展名。valid_referers ...
分类:
其他好文 时间:
2017-07-04 14:39:48
阅读次数:
167
一、题目 1、描述 2、题意 根据数独规则添加数独缺失的元素 二、解答 1、思路: 回溯 ...
分类:
其他好文 时间:
2017-07-03 16:17:28
阅读次数:
145
Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended fo ...
分类:
其他好文 时间:
2017-07-03 14:02:57
阅读次数:
206
Sudoku Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 14100 Accepted: 6961 Special Judge Description Sudoku is a very simple task. A squar ...
分类:
其他好文 时间:
2017-07-03 12:01:21
阅读次数:
166
题目如图 首先明确的是,可以有(()) ([])诸如此类的表达的。 然后用栈实现算法是,较为容易的。 判断总长度,不是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