
算法
文章平均质量分 80
苏雨田
多思考,多学习,多沉淀。
展开
-
LeetCode OJ平台上Binary Tree Postorder Traversal题目用java堆栈实现
原始题目如下,意为后序遍历二叉树,不要用递归。 Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1].原创 2014-06-07 16:09:16 · 710 阅读 · 1 评论 -
LeetCode OJ平台上Single Number II题目使用java位运算解决
原题如下,不让用extra Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implem原创 2014-06-11 21:55:11 · 618 阅读 · 0 评论 -
LeetCode OJ平台上的Climbing Stairs题目用java迭代解决
题目如下。 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? x原创 2014-06-11 22:11:51 · 661 阅读 · 0 评论 -
LeetCode OJ平台上Maximum Subarray题目O(n)复杂度解决方案
原始题目如下,意为寻找数组和最大的子串,返回这个最大和即可。 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the原创 2014-06-14 11:53:07 · 804 阅读 · 0 评论 -
LeetCode OJ平台上Sort Colors题目算法探讨
原题如下,意思就是说无序数组(由0,1,2组成),一遍扫描,把数组整理成0,1,2这样的序列。 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red,原创 2014-06-17 20:30:08 · 1023 阅读 · 0 评论