ARST
A
Leetcode20-- Valid Parentheses
题目要求
Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Example 1:
Input: "()"
Output: true
Example 2:
Input: "()[]{}"
Output: true
Example 3:
Input: "(]"
Output: false
Example 4:
Input: "([)]"
Output: false
Example 5:
Input: "{[]}"
Output: true
class Solution {
public:
bool isValid(string s) {
stack<char>list;
for(char& c:s)
{
/*经过许久的研究终于明白了这个代码的奥秘
*每一次if判断为true,则if判断为false时
*进行else语句进行比较,配对成功则继续for的循环
*以此直到结束
*/
if(c == '('|| c == '{' || c == '[')
{
list.push(c);
}
else
{
if(list.empty()) return false;
if(c == ')' && list.top() != '(') return false;
if(c == '}' && list.top() != '{') return false;
if(c == ']' && list.top() != '[') return false;
list.pop(); //从栈中移除栈顶元素
}
}
return list.empty(); //栈为空自然返回true
}
};
S
微软:黑客利用支持代理的凭据来访问客户电子邮件帐户
微软已经面临一个影响其基于网络的电子邮件服务的漏洞,黑客通过破坏客户支持代理的凭据进入系统,且微软告诉用户,它不知道黑客查看了哪些数据或原因,但警告用户可能会因此看到更多的网络钓鱼或垃圾邮件。这一事件反映了当今信息化时代虽然因为网络使我们的生活变得更加方便,同时我们也能够更加快速的了解到全球各地的新闻,但是这也让我们的个人信息处于一个曝光的状态,我们的信息早就属于公开状态,有恶意的人便会利用我们的信息影响到我们个人人生利益,所以信息安全这方便更应该不断加强,保证我们个人的信息安全
R
通过这周的学习,主要是C++中STL栈stack用法颇有收获
C++ Stack(堆栈) 是一个容器类的改编,为程序员提供了堆栈的全部功能,也就是说实现了一个先进后出(FILO)的数据结构。
c++ stl栈stack的头文件为:
#include
c++ stl栈stack的成员函数介绍
empty() 堆栈为空则返回true
pop() 移除栈顶元素
push() 在栈顶增加元素
size() 返回栈中元素数目
top() 返回栈顶元素
T
这周的程序设计基础课程降了继承,由于书上的内容有限,并不能很好的理解,找了一个网址,可以帮助对继承的理解http://www.cnblogs.com/quincyhu/p/5867490.html,与此同时,C++中的内容极为丰富,需要自己动手不断地练习,编写代码的能力才会有所提高