{"id":661,"date":"2021-07-14T00:02:50","date_gmt":"2021-07-14T00:02:50","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=661"},"modified":"2021-09-11T10:57:24","modified_gmt":"2021-09-11T10:57:24","slug":"how-to-find-next-greater-element-for-every-element-in-an-array","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/","title":{"rendered":"How to find next greater element for every element in an array ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"how-to-find-next-greater-element-for-every-element-in-an-array\" class=\"color-pink\" style=\"text-align: justify;\">How to find next greater element for every element in an array ?<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>In an array, to display the Next Greater Element (NGE) for every element.<\/li>\n<li>The Next greater Element for an element x is the first greater element on the right side of x value in an array.<\/li>\n<li>While the elements for which no greater element exist, consider the next greater element as 0.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"ImageContent\" style=\"text-align: justify;\">\n<div class=\"hddn\"><img decoding=\"async\" class=\"img-responsive center-block aligncenter\" src=\"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\" alt=\" NGE for every element in an array\" \/><\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>For any array, rightmost element always has next greater element as 0.<\/li>\n<li>Next greater element of an array element array[i], is an integer array[j], such that\n<ul>\n<li>array[i] < array[j]<\/li>\n<li>i < j<\/li>\n<li>j \u2013 i is minimum<\/li>\n<\/ul>\n<\/li>\n<li>i.e. array[j] is the first element on the right of array[i] which is greater than array[i].<\/li>\n<li>For Example the Input array is 88, 13, 44, 2, 10, 5, 17<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"output\" class=\"color-green\">Output<\/h2>\n<\/div>\n<\/div>\n<div class=\"Output\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<figure class=\"highlight\">\n<pre><code class=\"hljs bash\" data-lang=\"\"><span class=\"nt\">Next greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">13<\/span>     = <span class=\"hljs-number\">44<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">2<\/span>      = <span class=\"hljs-number\">10<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">5<\/span>      = <span class=\"hljs-number\">17<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">10<\/span>     = <span class=\"hljs-number\">17<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">17<\/span>     = <span class=\"hljs-number\">0<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">44<\/span>     = <span class=\"hljs-number\">0<\/span>\r\nNext greater element <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-number\">88<\/span>     = <span class=\"hljs-number\">0<\/span>\r\n<\/span><\/code><\/pre>\n<\/figure>\n<\/div>\n<\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"steps-for-finding-a-next-greater-element\" class=\"color-blue\">Steps for finding a next greater element<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>To find Next Great Element Using two loops.<\/li>\n<li>All the elements one by one to picks in the outer loop.<\/li>\n<li>The outer loop picked the first greater element from the inner loop.<\/li>\n<li>If a greater element is found then that element is printed as next, otherwise 0 is printed.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"sample-code-in-java\" class=\"color-blue\" style=\"text-align: justify;\">Sample Code in Java<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">class Wikitechy<br\/>{ <br\/>\t\/* prints element and NGE pair for <br\/>\tall elements of arr[] of size n *\/<br\/>\tstatic void printNGE(int arr[], int n) <br\/>\t{ <br\/>\t\tint n1, i, j; <br\/>\t\tfor (i=0; i<n; i++) <br\/>\t\t{ <br\/>\t\t\tn1 = 0; <br\/>\t\t\tfor (j = i+1; j<n; j++) <br\/>\t\t\t{ <br\/>\t\t\t\tif (arr[i] < arr[j]) <br\/>\t\t\t\t{ <br\/>\t\t\t\t\tn1 = arr[j]; <br\/>\t\t\t\t\tbreak; <br\/>\t\t\t\t} <br\/>\t\t\t} <br\/>\t\t\tSystem.out.println(arr[i]+&quot; -- &quot;+n1); <br\/>\t\t} <br\/>\t} <br\/>\t<br\/>\tpublic static void main(String args[]) <br\/>\t{ <br\/>\t\tint arr[]= {30, 35, 11, 17, 2}; <br\/>\t\tint n = arr.length; <br\/>\t\tprintNGE(arr, n);<br\/>        <br\/>\t} <br\/>}<\/code><\/pre> <\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"output-2\" class=\"color-blue\">Output<\/h2>\n<\/div>\n<\/div>\n<div class=\"Output\">\n<div class=\"hddn\">\n<figure class=\"highlight\" style=\"text-align: justify;\">\n<pre><code class=\"hljs\" data-lang=\"\"><span class=\"nt\">30 -- 35\r\n35 -- 0\r\n11 -- 17\r\n17 -- 0\r\n2 -- 0<\/span><\/code><\/pre>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : In an array, to display the Next Greater Element (NGE)&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4004],"tags":[195,491,360,4255,4257,203,199,214,198,363,209,205,4258,4259,4260,4263,2936,222,196,212,213,15932,286,207,366,4256,4261,4262,204,217,282,4023,483,4254,206,200,197,280,364,968],"class_list":["post-661","post","type-post","status-publish","format-standard","hentry","category-java","tag-accenture-interview-questions-and-answers","tag-applied-materials-interview-questions-and-answers","tag-atos-interview-questions-and-answers","tag-c-program-to-replace-every-element-with-the-next-greatest-element","tag-c-program-to-replace-an-element-in-an-array","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-find-next-greater-number-in-array","tag-find-next-greater-number-with-same-set-of-digits-leetcode","tag-find-next-greater-number-with-same-set-of-digits-python","tag-find-next-smaller-number-with-same-set-of-digits","tag-fis-global-business-solutions-india-pvt-ltd-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-infosys-technologies-interview-questions-and-answers","tag-infrrd-interview-questions-and-answers","tag-lt-infotech-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-next-greater-element-in-array-java","tag-next-greater-number-same-digits-in-c","tag-next-greater-permutation-in-c","tag-oracle-corporation-interview-questions-and-answers","tag-peoplestrong-interview-questions-and-answers","tag-persistent-systems-interview-questions-and-answers","tag-rbs-india-de-interview-questions-and-answers","tag-reliance-industries-ltd-interview-questions-and-answers","tag-replace-every-element-with-the-greatest-element-on-right-side-in-c","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-tech-mahindra-interview-questions-and-answers","tag-unitedhealth-group-interview-questions-and-answers","tag-virtusa-consulting-services-pvt-ltd-interview-questions-and-answers","tag-wells-fargo-interview-questions-and-answers","tag-wipro-infotech-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to find next greater element for every element in an array ? - Java<\/title>\n<meta name=\"description\" content=\"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to find next greater element for every element in an array ? - Java\" \/>\n<meta property=\"og:description\" content=\"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-14T00:02:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-11T10:57:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"How to find next greater element for every element in an array ?\",\"datePublished\":\"2021-07-14T00:02:50+00:00\",\"dateModified\":\"2021-09-11T10:57:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/\"},\"wordCount\":369,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\",\"keywords\":[\"Accenture interview questions and answers\",\"Applied Materials interview questions and answers\",\"Atos interview questions and answers\",\"c program to replace every element with the next greatest element\",\"c++ program to replace an element in an array\",\"Capgemini interview questions and answers\",\"CASTING NETWORKS INDIA PVT LIMITED interview questions and answers\",\"CGI Group Inc interview questions and answers\",\"Chetu interview questions and answers\",\"Ciena Corporation interview questions and answers\",\"Collabera Technologies interview questions and answers\",\"Dell International Services India Pvt Ltd interview questions and answers\",\"find next greater number in array\",\"find next greater number with same set of digits leetcode\",\"find next greater number with same set of digits python\",\"find next smaller number with same set of digits\",\"FIS Global Business Solutions India Pvt Ltd interview questions and answers\",\"Flipkart interview questions and answers\",\"IBM interview questions and answers\",\"Indecomm Global Services interview questions and answers\",\"Infosys Technologies interview questions and answers\",\"infrrd interview questions and answers\",\"L&amp;T Infotech interview questions and answers\",\"Mphasis interview questions and answers\",\"NetApp interview questions and answers\",\"next greater element in array java\",\"next greater number - same digits in c\",\"next greater permutation in c\",\"Oracle Corporation interview questions and answers\",\"PeopleStrong interview questions and answers\",\"Persistent Systems interview questions and answers\",\"RBS India De interview questions and answers\",\"Reliance Industries Ltd interview questions and answers\",\"replace every element with the greatest element on right side in c++\",\"SAP Labs India Pvt Ltd interview questions and answers\",\"Tech Mahindra interview questions and answers\",\"UnitedHealth Group interview questions and answers\",\"Virtusa Consulting Services Pvt Ltd interview questions and answers\",\"Wells Fargo interview questions and answers\",\"Wipro Infotech interview questions and answers\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/\",\"name\":\"How to find next greater element for every element in an array ? - Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\",\"datePublished\":\"2021-07-14T00:02:50+00:00\",\"dateModified\":\"2021-09-11T10:57:24+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\",\"contentUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/java\\\/how-to-find-next-greater-element-for-every-element-in-an-array.gif\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to find next greater element for every element in an array ? - Java","description":"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/","og_locale":"en_US","og_type":"article","og_title":"How to find next greater element for every element in an array ? - Java","og_description":"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/","og_site_name":"Wikitechy","article_published_time":"2021-07-14T00:02:50+00:00","article_modified_time":"2021-09-11T10:57:24+00:00","og_image":[{"url":"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif","type":"","width":"","height":""}],"author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"How to find next greater element for every element in an array ?","datePublished":"2021-07-14T00:02:50+00:00","dateModified":"2021-09-11T10:57:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/"},"wordCount":369,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif","keywords":["Accenture interview questions and answers","Applied Materials interview questions and answers","Atos interview questions and answers","c program to replace every element with the next greatest element","c++ program to replace an element in an array","Capgemini interview questions and answers","CASTING NETWORKS INDIA PVT LIMITED interview questions and answers","CGI Group Inc interview questions and answers","Chetu interview questions and answers","Ciena Corporation interview questions and answers","Collabera Technologies interview questions and answers","Dell International Services India Pvt Ltd interview questions and answers","find next greater number in array","find next greater number with same set of digits leetcode","find next greater number with same set of digits python","find next smaller number with same set of digits","FIS Global Business Solutions India Pvt Ltd interview questions and answers","Flipkart interview questions and answers","IBM interview questions and answers","Indecomm Global Services interview questions and answers","Infosys Technologies interview questions and answers","infrrd interview questions and answers","L&amp;T Infotech interview questions and answers","Mphasis interview questions and answers","NetApp interview questions and answers","next greater element in array java","next greater number - same digits in c","next greater permutation in c","Oracle Corporation interview questions and answers","PeopleStrong interview questions and answers","Persistent Systems interview questions and answers","RBS India De interview questions and answers","Reliance Industries Ltd interview questions and answers","replace every element with the greatest element on right side in c++","SAP Labs India Pvt Ltd interview questions and answers","Tech Mahindra interview questions and answers","UnitedHealth Group interview questions and answers","Virtusa Consulting Services Pvt Ltd interview questions and answers","Wells Fargo interview questions and answers","Wipro Infotech interview questions and answers"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/","name":"How to find next greater element for every element in an array ? - Java","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif","datePublished":"2021-07-14T00:02:50+00:00","dateModified":"2021-09-11T10:57:24+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"How to find next greater element for every element in an array ? - In an array, to display the Next Greater Element (NGE) for every element.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array\/#primaryimage","url":"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif","contentUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/java\/how-to-find-next-greater-element-for-every-element-in-an-array.gif"},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=661"}],"version-history":[{"count":2,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/661\/revisions"}],"predecessor-version":[{"id":3400,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/661\/revisions\/3400"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}