随笔分类 - C++
摘要:二叉树的遍历是面试中经常考察的,其实前中后三种顺序的遍历都大同小异,自己模拟两个栈用笔画画我相信是不难写出代码的。现罗列如下,均是自己所写已通过leetcode。 1 class Solution { 2 public: 3 vector preorderTraversal(TreeNode...
阅读全文
摘要:Notice: How to compile C++ with C++ 11 support in Mac Terminalstackoverflow上面的问题其实mac里面的不是g++而是clang 我们输入:g++ --version查看其实是clangso linux下的g++ -std=c+...
阅读全文
摘要:Notice:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.For example:Input: ["tea","an...
阅读全文
摘要:上周算法班的BEN老师花了1个小时讲自动机和KMP的关系,结果failed...明天又要上课了,花了半天时间看了下KMP,暂且停留在利用next求模式中的跳跃长度,自动机那个还不能理解。。。具体的可以百度阮一峰的KMP算法。看着什么前缀后缀,突然想到上下文无关文法乔姆斯基范式了。。。。又想到了NFA...
阅读全文
摘要:记得去年9月28日赶到交大去听july的算法面试讲座,他给我们出的第一个题目就是用代码实现atoi,限时10mins。由于当时很久没接触编程,当堂没写出来。记得当时讲解的时候就是要我们特别注意边界条件。写程序就像砌围墙,得先把边界条件弄好。转眼一年过去了,再过几个月就要出去hunting job...
阅读全文
摘要:题目:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any poi...
阅读全文

浙公网安备 33010602011771号