摘要: 这道题不是循环数组用的是栈存储的是数组的值不是下标,如果是循环数组用值会出现无法确定结果要赋值到哪个位置 class Solution { public int[] nextGreaterElement(int[] nums1, int[] nums2) { //不是循环数组 int[] res = 阅读全文
posted @ 2020-08-02 21:18 浅滩浅 阅读(116) 评论(0) 推荐(0)
摘要: ##时间复杂度O(n^2) class Solution { public int[] nextGreaterElements(int[] nums) { int[] res = new int[nums.length]; int top = 0; for(int i=0;i<nums.length 阅读全文
posted @ 2020-08-02 20:55 浅滩浅 阅读(72) 评论(0) 推荐(0)
摘要: 前序遍历+重赋值 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(i 阅读全文
posted @ 2020-08-02 17:18 浅滩浅 阅读(83) 评论(0) 推荐(0)