{"id":864,"date":"2025-08-11T11:52:43","date_gmt":"2025-08-11T06:22:43","guid":{"rendered":"https:\/\/codeanddebug.in\/blog\/?p=864"},"modified":"2025-08-11T11:52:44","modified_gmt":"2025-08-11T06:22:44","slug":"next-greater-element-ii","status":"publish","type":"post","link":"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/","title":{"rendered":"Next Greater Element II | Leetcode 503 | Imaginary List Optimal Solution"},"content":{"rendered":"\n<p>Given a circular integer array&nbsp;<code>nums<\/code>&nbsp;(i.e., the next element of&nbsp;<code>nums[nums.length - 1]<\/code>&nbsp;is&nbsp;<code>nums[0]<\/code>), return&nbsp;<em>the&nbsp;<strong>next greater number<\/strong>&nbsp;for every element in<\/em>&nbsp;<code>nums<\/code>.<\/p>\n\n\n\n<p>Here&#8217;s the [<strong><a href=\"https:\/\/leetcode.com\/problems\/next-greater-element-ii\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><span style=\"text-decoration: underline;\">Problem Link<\/span><\/mark><\/a><\/strong>] to begin with.<\/p>\n\n\n\n<p>The&nbsp;<strong>next greater number<\/strong>&nbsp;of a number&nbsp;<code>x<\/code>&nbsp;is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next greater number. If it doesn&#8217;t exist, return&nbsp;<code>-1<\/code>&nbsp;for this number.<\/p>\n\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Input:<\/strong> nums = [1,2,1]<br><strong>Output:<\/strong> [2,-1,2]<br>Explanation: The first 1's next greater number is 2; <br>The number 2 can't find next greater number. <br>The second 1's next greater number needs to search circularly, which is also 2.<\/pre>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Input:<\/strong> nums = [1,2,3,4,3]<br><strong>Output:<\/strong> [2,3,4,-1,4]<\/pre>\n\n\n\n<p><strong>Constraints:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>1 &lt;= nums.length &lt;= 10<sup>4<\/sup><\/code><\/li>\n\n\n\n<li><code>-10<sup>9<\/sup> &lt;= nums[i] &lt;= 10<sup>9<\/sup><\/code><\/li>\n<\/ul>\n\n\n<div style=\"max-width: -moz-fit-content; \" class=\"wp-block-ub-table-of-contents-block ub_table-of-contents ub_table-of-contents-collapsed\" id=\"ub_table-of-contents-b68022ae-45b9-4ca9-b5df-9104220c4d88\" data-linktodivider=\"false\" data-showtext=\"show\" data-hidetext=\"hide\" data-scrolltype=\"auto\" data-enablesmoothscroll=\"true\" data-initiallyhideonmobile=\"true\" data-initiallyshow=\"false\"><div class=\"ub_table-of-contents-header-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-header\" style=\"text-align: left; \">\n\t\t\t\t<div class=\"ub_table-of-contents-title\">Contents:<\/div>\n\t\t\t\t<div class=\"ub_table-of-contents-header-toggle\">\n\t\t\t<div class=\"ub_table-of-contents-toggle\" style=\"\">\n\t\t\t\u00a0[<a class=\"ub_table-of-contents-toggle-link\" href=\"#\" style=\"\">show<\/a>]\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div><div class=\"ub_table-of-contents-extra-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-container ub_table-of-contents-1-column ub-hide\">\n\t\t\t\t<ul style=\"\"><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#0-optimal-approach-monotonic-stack-for-circular-arrays\" style=\"\">Optimal Approach: Monotonic Stack for Circular Arrays<\/a><ul><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#1-intuition\" style=\"\">Intuition<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#2-detailed-approach\" style=\"\">Detailed Approach<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#3-code\" style=\"\">Code<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#4-code-explanation\" style=\"\">Code Explanation<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#5-dry-run-example\" style=\"\">Dry Run Example<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#6-time-and-space-complexity\" style=\"\">Time and Space Complexity<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#7-simplified\" style=\"\">Simplified<\/a><\/li><\/ul><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#8-summary-table\" style=\"\">Summary Table<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/next-greater-element-ii\/#9-conclusion\" style=\"\">Conclusion<\/a><\/li><\/ul>\n\t\t\t<\/div>\n\t\t<\/div><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0-optimal-approach-monotonic-stack-for-circular-arrays\">Optimal Approach: Monotonic Stack for Circular Arrays<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-intuition\">Intuition<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In a\u00a0<em>non-circular<\/em>\u00a0Next Greater Element problem, you process elements from right to left using a stack and can stop once you reach the beginning.<\/li>\n\n\n\n<li>In the\u00a0<em>circular<\/em>\u00a0case, an element\u2019s NGE might only appear\u00a0<strong>after the end<\/strong>, so you must symbolically \u201cloop\u201d through the array twice.<\/li>\n\n\n\n<li>This is achieved by iterating from 2*n &#8211; 1 down to 0, using\u00a0<code>i % n<\/code>\u00a0so the second \u201cpass\u201d is seamless.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-detailed-approach\">Detailed Approach<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Prepare a result array (size n), all -1.<\/li>\n\n\n\n<li>Traverse from index\u00a0<code>2*n-1<\/code>\u00a0to\u00a0<code>0<\/code>\u00a0(effectively simulating two passes).<\/li>\n\n\n\n<li>At each index i:\n<ul class=\"wp-block-list\">\n<li>While stack isn\u2019t empty and stack&#8217;s top is\u00a0<strong>\u2264 current value<\/strong>, pop from stack.<\/li>\n\n\n\n<li>If within the first pass (<code>i &lt; n<\/code>), set the result: if stack not empty, NGE is stack top; else, -1.<\/li>\n\n\n\n<li>Push current value onto the stack for use in subsequent NGE lookups.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-code\">Code<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class Solution:\n    def nextGreaterElements(self, nums: List[int]) -&gt; List[int]:\n        n = len(nums)\n        result = [-1] * n    # Initialize results with -1\n        stack = []           # Stack for potential NGEs\n\n        # Loop twice to simulate circular array\n        for i in range(2 * n - 1, -1, -1):\n            # Maintain decreasing stack\n            while stack and stack[-1] &lt;= nums[i % n]:\n                stack.pop()\n            # Only set result during the first 'real' pass\n            if i &lt; n:\n                if stack:\n                    result[i] = stack[-1]\n            # Push current value for next iteration checks\n            stack.append(nums[i % n])\n        return result\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Solution<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">nextGreaterElements<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">nums<\/span><span style=\"color: #D4D4D4\">: List[<\/span><span style=\"color: #4EC9B0\">int<\/span><span style=\"color: #D4D4D4\">]) -&gt; List[<\/span><span style=\"color: #4EC9B0\">int<\/span><span style=\"color: #D4D4D4\">]:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        n = <\/span><span style=\"color: #DCDCAA\">len<\/span><span style=\"color: #D4D4D4\">(nums)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        result = [-<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">] * n    <\/span><span style=\"color: #6A9955\"># Initialize results with -1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        stack = []           <\/span><span style=\"color: #6A9955\"># Stack for potential NGEs<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># Loop twice to simulate circular array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> i <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">range<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\"> * n - <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">, -<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">, -<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Maintain decreasing stack<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\"> stack <\/span><span style=\"color: #569CD6\">and<\/span><span style=\"color: #D4D4D4\"> stack[-<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">] &lt;= nums[i % n]:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                stack.pop()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Only set result during the first &#39;real&#39; pass<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> i &lt; n:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> stack:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    result[i] = stack[-<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Push current value for next iteration checks<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            stack.append(nums[i % n])<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> result<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-code-explanation\">Code Explanation<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Processing from right to left and looping twice<\/strong>\u00a0lets every number have access to all elements on its right, even those past the end.<\/li>\n\n\n\n<li><strong>Stack<\/strong>: Keeps potential &#8220;Next Greater Elements&#8221;, always in descending order.<\/li>\n\n\n\n<li>For each index:\n<ul class=\"wp-block-list\">\n<li>Pop smaller (or equal) elements, they cannot be NGE for anyone to their left.<\/li>\n\n\n\n<li>For the first n elements, update result if stack isn\u2019t empty.<\/li>\n\n\n\n<li>Push current value for future queries.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-dry-run-example\">Dry Run Example<\/h3>\n\n\n\n<p>nums = [1, 2, 1]<a href=\"https:\/\/leetcode.com\/problems\/next-greater-element-ii\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>i = 5 (nums = 1): stack empty; push 1.<a href=\"https:\/\/www.geeksforgeeks.org\/dsa\/next-greater-element\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li>i = 4 (nums = 2): pop 1 (since 1 &lt; 2); stack empty; push 2.<a href=\"https:\/\/leetcode.com\/problems\/next-greater-element-ii\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li>i = 3 (nums = 1): stack top 2 > 1; NGE=2; push 1.<\/li>\n\n\n\n<li>Now first pass:<\/li>\n\n\n\n<li>i = 2 (nums=1): stack top 2 > 1; result=2; push 1.<a href=\"https:\/\/www.geeksforgeeks.org\/dsa\/next-greater-element\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li>i = 1 (nums=2): pop 1; stack top 2 = 2; pop 2; stack empty; result=-1; push 2.<a href=\"https:\/\/leetcode.com\/problems\/next-greater-element-ii\/description\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li>i = 0 (nums=1): stack top 2 > 1; result=2; done.<\/li>\n<\/ul>\n\n\n\n<p>Result: [2, -1, 2]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6-time-and-space-complexity\">Time and Space Complexity<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Time:<\/strong>\u00a0O(n), where n = len(nums). Every element is pushed\/popped at most twice (over two passes).<a href=\"https:\/\/algo.monster\/liteproblems\/503\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><strong>Space:<\/strong>\u00a0O(n) for the result array and the stack.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7-simplified\">Simplified<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Monotonic stack, classic method for all NGE type problems.<\/li>\n\n\n\n<li>\u201cLooping\u201d via\u00a0<code>i % n<\/code>\u00a0elegantly handles circular logic.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8-summary-table\">Summary Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Approach<\/th><th>Time<\/th><th>Space<\/th><th>Best For<\/th><\/tr><\/thead><tbody><tr><td>Optimal (Stack)<\/td><td>O(n)<\/td><td>O(n)<\/td><td>Large\/circular n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9-conclusion\">Conclusion<\/h2>\n\n\n\n<p>The&nbsp;<strong>Next Greater Element II<\/strong>&nbsp;(circular variant) is the perfect interview test of your stack and array mastery. Practice with several input types (all equal, strictly decreasing, etc.), and always loop twice for circular logic using the modulo trick!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codeanddebug.in\/course\/zero-to-hero-python-dsa\" target=\"_blank\" rel=\"noreferrer noopener\">Join our Advance DSA COURSE<\/a><\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>For any changes to the article, kindly email at <a href=\"mailto:code@codeanddebug.in\" target=\"_blank\" rel=\"noreferrer noopener\">code@codeanddebug.in<\/a> or contact us at <a href=\"tel:+91-9712928220\" target=\"_blank\" rel=\"noreferrer noopener\">+91-9712928220<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Given a circular integer array&nbsp;nums&nbsp;(i.e., the next element of&nbsp;nums[nums.length &#8211; 1]&nbsp;is&nbsp;nums[0]), return&nbsp;the&nbsp;next greater number&nbsp;for every element in&nbsp;nums. Here&#8217;s the [Problem Link] to begin with. The&nbsp;next greater number&nbsp;of a number&nbsp;x&nbsp;is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next greater number. If it doesn&#8217;t<\/p>\n","protected":false},"author":1,"featured_media":865,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[3,6],"tags":[19,37],"class_list":{"0":"post-864","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-structures-and-algorithm","8":"category-intermediate","9":"tag-medium","10":"tag-stack-and-queues"},"featured_image_src":"https:\/\/codeanddebug.in\/blog\/wp-content\/uploads\/2025\/08\/next-greater-element-II-featured-image.png","author_info":{"display_name":"codeanddebug","author_link":"https:\/\/codeanddebug.in\/blog\/author\/codeanddebug\/"},"_links":{"self":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/comments?post=864"}],"version-history":[{"count":1,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/864\/revisions"}],"predecessor-version":[{"id":866,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/864\/revisions\/866"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media\/865"}],"wp:attachment":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media?parent=864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/categories?post=864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/tags?post=864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}