• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2014年10月14日
Leetcode: Maximum Product Subarray
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],th... 阅读全文
posted @ 2014-10-14 08:23 neverlandly 阅读(552) 评论(0) 推荐(0)
Leetcode: Evaluate Reverse Polish Notation
摘要: 难度:70. RPN中文名字叫做逆波兰表示法,它的好处维基百科说了,就是不需要括号来表示运算的先后,直接根据式子本身就可以求解。解题思路就是维护一个栈,遇到数字就入栈,遇到操作符就两次出栈得到栈顶的两个操作数,运用操作符进行运算以后,再把结果入栈。直到式子结束,此时栈中唯一一个元素便是结果。 以上代 阅读全文
posted @ 2014-10-14 07:52 neverlandly 阅读(492) 评论(0) 推荐(0)
Leetcode: Clone Graph
摘要: Leetcode里关于图的题其实并不多,这道题就是其中之一。DFS深度优先搜索和BFS广度优先搜索都可以做,遍历完原图的所有节点。这道题的难点在于neighbour关系的拷贝:原图中某一个点跟一些点具有neighbour关系,那么该点的拷贝也要与上述那些点的拷贝具有neighbour关系。那么,就需 阅读全文
posted @ 2014-10-14 07:08 neverlandly 阅读(409) 评论(0) 推荐(0)
Leetcode: Text Justification
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You shoul... 阅读全文
posted @ 2014-10-14 05:31 neverlandly 阅读(431) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3