public class Solution {
public int[] NextGreaterElement(int[] findNums, int[] nums) {
var list = new List<int>(); foreach (var num in findNums)
{
for (int i = ; i < nums.Length; i++)
{
if (num == nums[i])
{
var cur = -;
for (int j = i + ; j < nums.Length; j++)
{
if (nums[j] > num)
{
cur = nums[j];
break;
}
}
list.Add(cur);
}
}
} //foreach (var l in list)
//{
// Console.WriteLine(l.ToString());
//} return list.ToArray();
}
}

https://leetcode.com/problems/next-greater-element-i/#/description

leetcode496的更多相关文章

  1. [Swift]LeetCode496. 下一个更大元素 I | Next Greater Element I

    You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of n ...

  2. (栈)leetcode496. Next Greater Element I

    You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of n ...

  3. Leetcode496.Next Greater Element I下一个更大的元素1

    给定两个没有重复元素的数组 nums1 和 nums2 ,其中nums1 是 nums2 的子集.找到 nums1 中每个元素在 nums2 中的下一个比其大的值. nums1 中数字 x 的下一个更 ...

  4. LeetCode-Stack-Easy

    简单题 1. 有效的括号(leetcode-20) 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效. 有效字符串需满足: 1. 左括号必须用相同类型的右括 ...

随机推荐

  1. summernote 如何设置为只读?

    从 summernote 的文档看到以下信息. disable, enable You can disable editor by API. $('#summernote').summernote(' ...

  2. 【转】每天一个linux命令(34):du 命令

    原文网址:http://www.cnblogs.com/peida/archive/2012/12/10/2810755.html Linux du命令也是查看使用空间的,但是与df命令不同的是Lin ...

  3. git add -A、git add -u、git add .区别

    git add各命令及缩写 git add各命令 缩写 git add --all git add -A git add --update git add -u git add . Git Versi ...

  4. Jupyter和IPython

    Jupyter内核就是IPython(Interactive Python):你看到的按tab键能够自动提示/补齐都是IPython实现的. IPython其实不只限于IPython,其实你看到的ID ...

  5. JMeter--使用HTTP信息头管理器

    使用HTTP信息头管理,可以帮助测试人员设定JMeter发送的HTTP请求头所包含的信息.HTTP信息头中包含有”User-Agent".“Pragma".”Referer&quo ...

  6. 【python】python中__name__的使用

    Py1.py #!/usr/bin/env python def test(): print '__name__ = ',__name__ if __name__ == '__main__': tes ...

  7. CXF运行wsdl2java :找不到系统路径

    已经配置好cxf的环境变量出现 解决方法:一定要设置JAVA_HOME这个变量

  8. NET中调用存储过程(Output、Input)

    NET中调用存储过程(Output.Input) .NET中调用存储过程(Output.Input) 带输入输出参数的存储过程 带输入输出参数的存储过程 create procedure itemCo ...

  9. .gitignore 存放位置

    放在仓库根目录下即可.比如你的仓库在“D:\MYREPO”,位置就是“D:\MYREPO\.gitignore”. 模板可从GITHUB上COPY一份.

  10. Eclipse中不让.svn文件夹一同编译到class中

    开发过程中一直在用SVN做版本控制,使用Eclipse编译文件后,classes文件中总是有.svn的文件夹,在做提交时有时会报错,这些文件没有什么用,而且影响build的速度. 更恼火的是, 如果一 ...