{"id":3536,"date":"2021-11-11T18:25:51","date_gmt":"2021-11-11T12:55:51","guid":{"rendered":"https:\/\/www.interviewbit.com\/blog\/?p=3536"},"modified":"2022-01-11T12:51:55","modified_gmt":"2022-01-11T07:21:55","slug":"kth-largest-element-of-array","status":"publish","type":"post","link":"https:\/\/www.interviewbit.com\/blog\/kth-largest-element-of-array\/","title":{"rendered":"Kth Largest Element In An Array"},"content":{"rendered":"\n<div class=\"gutentoc tocactive ullist\" style=\"max-width:400px\"><div class=\"gutentoc-toc-wrap\"><div class=\"gutentoc-toc-title-wrap\"><div class=\"gutentoc-toc-title\">Table Of Contents<\/div><div id=\"open\" class=\"toggletwo\">show<\/div><\/div><div id=\"toclist\"><div class=\"gutentoc-toc__list-wrap\"><ul class=\"gutentoc-toc__list\"><li><a href=\"#problem-statement\">Problem Statement<\/a><\/li><li><a href=\"#approach-1-sort\">Approach 1: Sort<\/a><\/li><ul class=\"gutentoc-toc__list\"><li><a href=\"#c-code\">C++ Code<\/a><\/li><li><a href=\"#java-code\">Java Code<\/a><\/li><li><a href=\"#python-code\">Python Code<\/a><\/li><\/ul><li><a href=\"#approach-2-heap\">Approach 2: Heap<\/a><\/li><ul class=\"gutentoc-toc__list\"><li><a href=\"#c-code\">C++ Code<\/a><\/li><li><a href=\"#java-code\">Java Code<\/a><\/li><li><a href=\"#python-code\">Python Code<\/a><\/li><\/ul><li><a href=\"#approach-3-using-quick-select\">Approach 3: Using Quick Select<\/a><\/li><ul class=\"gutentoc-toc__list\"><li><a href=\"#c-code\">C++ Code<\/a><\/li><li><a href=\"#java-code\">Java Code<\/a><\/li><li><a href=\"#python-code\">Python Code<\/a><\/li><\/ul><li><a href=\"#faqs\">FAQs<\/a><\/li><\/ul><\/div><\/div><\/div><\/div>\n\n\n\n<h2 id=\"problem-statement\">Problem Statement<\/h2>\n\n\n\n<p>Given an integer array, <strong>A[]<\/strong> and an integer <strong>K<\/strong>. The task is to return the <strong>Kth <\/strong>largest element in an array.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img  loading=\"lazy\"  width=\"563\"  height=\"1024\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"array arrangement\"  class=\"wp-image-3586 pk-lazyload\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"(max-width: 563px) 100vw, 563px\"  data-pk-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-563x1024.png\"  data-pk-srcset=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-563x1024.png 563w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-165x300.png 165w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-768x1397.png 768w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-380x691.png 380w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-550x1001.png 550w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement-800x1456.png 800w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/array-arrangement.png 820w\" ><\/figure>\n\n\n\n<p><strong>Examples:<\/strong><\/p>\n\n\n\n<p><strong>Input: <\/strong>A[] = {1, 2, 6, 4, 5}, K = 3<br><strong>Output: <\/strong>4<br><strong>Explanation: <\/strong>Provided in image above<\/p>\n\n\n\n<p><strong>Input: <\/strong>&nbsp;A[] = {3, 2, 1, 5, 6, 4}, K = 2<br><strong>Output:<\/strong> 5<\/p>\n\n\n\n<h2 id=\"approach-1-sort\">Approach 1: Sort<\/h2>\n\n\n\n<p>The most naive approach to solve this problem is to simply sort the given array in descending order and return the Kth element from the beginning of the array.<\/p>\n\n\n\n<h3 id=\"c-code\"><span id=\"c-code-2\">C++ Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">int kthLargest(vector &lt; int > &amp; arr, int size, int K) {\n  sort(arr.begin(), arr.end(), greater &lt; int > ());\n  return arr[K - 1];\n}<\/pre>\n\n\n\n<h3 id=\"java-code\"><span id=\"java-code-2\">Java Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">static int kthLargest(ArrayList &lt; Integer > arr, int size, int K) {\n  Collections.sort(arr, Collections.reverseOrder());\n  return arr.get(K - 1);\n}<\/pre>\n\n\n\n<h3 id=\"python-code\"><span id=\"python-code-2\">Python Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def kthLargest(arr, size, k):\n    arr = sorted(arr, reverse=True)\n    return arr[k - 1]<\/pre>\n\n\n\n<p><strong>Time Complexity:<\/strong> O(NlogN), where N is the size of the array.<br><strong>Space Complexity:<\/strong> O(1), since no additional space is used.<\/p>\n\n\n\n<h2 id=\"approach-2-heap\">Approach 2: Heap<\/h2>\n\n\n\n<p>The previous approach of sorting and finding the <strong>Kth <\/strong>largest element is costly. Since the task is to return the <strong>Kth<\/strong> largest element, the idea would be to maintain a data structure that keeps the elements of the array in sorted order, along with reducing the time complexity.<\/p>\n\n\n\n<p>The idea is to use a <strong>max-heap. <\/strong>Since <strong>max-heap<\/strong> keeps all the elements in sorted order, the problem simply converts to print the <strong>Kth<\/strong> element of the <strong>max-heap<\/strong>.<\/p>\n\n\n\n<p>Let us try to understand this with the help of an example.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img  loading=\"lazy\"  width=\"617\"  height=\"1024\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"Kth element of the max-heap\"  class=\"wp-image-3592 pk-lazyload\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"(max-width: 617px) 100vw, 617px\"  data-pk-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-617x1024.png\"  data-pk-srcset=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-617x1024.png 617w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-181x300.png 181w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-768x1274.png 768w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-926x1536.png 926w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-1235x2048.png 1235w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-380x630.png 380w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-550x912.png 550w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-800x1327.png 800w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap-1160x1924.png 1160w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-of-the-max-heap.png 1269w\" ><\/figure>\n\n\n\n<p><strong>Algorithm :<\/strong><\/p>\n\n\n\n<ul><li>Initialise a <strong>max-heap<\/strong>.<\/li><li>Insert all the elements of the given array into the <strong>max heap<\/strong>.<\/li><li>Extract the first <strong>K &#8211; 1<\/strong> elements from the heap.<\/li><li>Print the top element of the max heap.<\/li><\/ul>\n\n\n\n<h3 id=\"c-code\"><span id=\"c-code-3\">C++ Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">int kthLargest(vector &lt; int > &amp; arr, int size, int K) {\n  priority_queue &lt; int > pq;\n  int val;\n  for (int i = 0; i &lt; size; i++) {\n    pq.push(arr[i]);\n  }\n  int l = K - 1;\n  while (l > 0) {\n    pq.pop();\n    l--;\n  }\n \n  return pq.top();\n}<\/pre>\n\n\n\n<h3 id=\"java-code\"><span id=\"java-code-3\">Java Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> static int kthLargest(ArrayList &lt; Integer > arr, int size, int K) {\n  PriorityQueue &lt; Integer > pq = new PriorityQueue &lt; Integer > (Collections.reverseOrder());\n  for (int i = 0; i &lt; size; i++) {\n    pq.add(arr.get(i));\n  }\n  int l = K - 1;\n  while (l > 0) {\n    pq.poll();\n    l = l - 1;\n  }\n \n  return pq.peek();\n}<\/pre>\n\n\n\n<h3 id=\"python-code\"><span id=\"python-code-3\">Python Code<\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import heapq\n \n \ndef kthLargest(arr, size, k):\n    pq = []\n \n    for i in range(size):\n        heapq.heappush(pq, -1 * arr[i])\n \n    l = k - 1\n    while l > 0:\n        heapq.heappop(pq)\n        l = l - 1\n \n    return -1 * pq[0]<\/pre>\n\n\n\n<p><strong>Time Complexity:<\/strong> O(K + (N &#8211; K) * log(K) ), where N is size of the array.<br>Space Complexity: O(K), since the heap is used.<\/p>\n\n\n\n<h2 id=\"approach-3-using-quick-select\">Approach 3: Using Quick Select<\/h2>\n\n\n\n<p>The approach is to use a <strong>quick select <\/strong>approach. This method is very similar to the <strong>quick sort<\/strong> approach.<\/p>\n\n\n\n<p>It can be clearly observed that <strong>Kth<\/strong> largest element is the same as <strong>(N &#8211; K)th<\/strong> smallest element, where <strong>N <\/strong>is the size of the given array. Therefore, we can apply the <strong>Kth<\/strong> smallest approach to this problem.<\/p>\n\n\n\n<p>Firstly, a <strong>pivot<\/strong> element must be chosen, similar to what we do in <strong>quicksort<\/strong>. It can be done using the partition algorithm.<br>Remind: In the partition algorithm, all elements are compared to the pivot element, and the elements less than the pivot are moved towards the left side and greater are moved toward the <strong>right.<\/strong><br>Now, since the array has been divided into two parts, ignore one part and simply search for <strong>N &#8211; Kth<\/strong> element in the other part.<br><br>Let us understand this with an example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img  loading=\"lazy\"  width=\"1024\"  height=\"1024\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"N - Kth element in the other part\"  class=\"wp-image-3599 pk-lazyload\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"(max-width: 1024px) 100vw, 1024px\"  data-pk-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-1024x1024.png\"  data-pk-srcset=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-1024x1024.png 1024w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-300x300.png 300w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-150x150.png 150w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-768x769.png 768w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-80x80.png 80w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-110x110.png 110w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-380x380.png 380w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-550x550.png 550w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-800x801.png 800w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part-1160x1161.png 1160w, https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/11\/Kth-element-in-the-other-part.png 1269w\" ><\/figure>\n\n\n\n<p><strong>Algorithm:<\/strong><\/p>\n\n\n\n<ul><li>Choose any random element of the array as <strong>pivot<\/strong>.<\/li><li>Use the <strong>partition algorithm <\/strong>to partition the array into two parts and place the <strong>pivot <\/strong>element in its correct position<strong>,<\/strong> <strong>idx<\/strong>.<\/li><li>Now, since, all elements to the left of pivot are smaller and to the right of pivot are larger, compare the value of <strong>idx<\/strong> with <strong>N &#8211; K<\/strong> and recursively choose the part of the array to find the <strong>Kth<\/strong> largest element of the aray.<\/li><\/ul>\n\n\n\n<h3 id=\"c-code\">C++ Code<\/h3>\n\n\n\n<p>In CPP, there is an inbuilt <strong>reverse <\/strong>function in the <strong>algorithm<\/strong> header file, which when accessed can reverse string\/array.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">int findKthLargest(int nums[], int k) {\n  if (nums.size() == 1) {\n    return nums[0];\n  }\n \n  int lo = 0;\n  int hi = nums.length - 1;\n  int targetIndex = nums.length - k;\n \n  while (lo &lt;= hi) {\n    int pivot = partition(nums, lo, hi);\n    if (pivot &lt; targetIndex) {\n      lo = pivot + 1;\n    } else if (pivot > targetIndex) {\n      hi = pivot - 1;\n    } else {\n      return nums[pivot];\n    }\n  }\n \n  throw null;\n}\n \nint partition(int[] nums, int lo, int hi) {\n  int pivotVal = nums[hi];\n  int wall = lo;\n  for (int i = lo; i &lt; hi; i++) {\n    if (nums[i] &lt; pivotVal) {\n      swap(nums, wall, i);\n      wall++;\n    }\n  }\n  swap(nums, wall, hi);\n  return wall;\n}\n \nvoid swap(int[] nums, int i, int j) {\n  int temp = nums[i];\n  nums[i] = nums[j];\n  nums[j] = temp;\n}<\/pre>\n\n\n\n<h3 id=\"java-code\">Java Code<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> int[] nums;\n \npublic void swap(int a, int b) {\n  int tmp = this.nums[a];\n  this.nums[a] = this.nums[b];\n  this.nums[b] = tmp;\n}\n \npublic int partition(int left, int right, int pivot_index) {\n  int pivot = this.nums[pivot_index];\n  swap(pivot_index, right);\n  int store_index = left;\n  for (int i = left; i &lt;= right; i++) {\n    if (this.nums[i] &lt; pivot) {\n      swap(store_index, i);\n      store_index++;\n    }\n  }\n  swap(store_index, right);\n \n  return store_index;\n}\n \npublic int quickselect(int left, int right, int k_smallest) {\n  if (left == right)\n    return this.nums[left];\n \n  Random random_num = new Random();\n  int pivot_index = left + random_num.nextInt(right - left);\n \n  pivot_index = partition(left, right, pivot_index);\n  if (k_smallest == pivot_index)\n    return this.nums[k_smallest];\n  else if (k_smallest &lt; pivot_index)\n    return quickselect(left, pivot_index - 1, k_smallest);\n  return quickselect(pivot_index + 1, right, k_smallest);\n}\n \npublic int findKthLargest(int[] nums, int k) {\n  this.nums = nums;\n  int size = nums.length;\n  return quickselect(0, size - 1, size - k);\n}<\/pre>\n\n\n\n<h3 id=\"python-code\">Python Code<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def findKthLargest(nums, k):\n        def partition(left, right, pivot_index):\n            pivot = nums[pivot_index]\n            nums[pivot_index], nums[right] = nums[right], nums[pivot_index]  \n            \n            store_index = left\n            for i in range(left, right):\n                if nums[i] &lt; pivot:\n                    nums[store_index], nums[i] = nums[i], nums[store_index]\n                    store_index += 1\n \n            nums[right], nums[store_index] = nums[store_index], nums[right]  \n            \n            return store_index\n        \n        def select(left, right, k_smallest):\n            if left == right:   \n                return nums[left] \n            \n            pivot_index = random.randint(left, right)       \n            pivot_index = partition(left, right, pivot_index)\n            if k_smallest == pivot_index:\n                 return nums[k_smallest]\n            elif k_smallest &lt; pivot_index:\n                return select(left, pivot_index - 1, k_smallest)\n            else:\n                return select(pivot_index + 1, right, k_smallest)\n \n        return select(0, len(nums) - 1, len(nums) - k)<\/pre>\n\n\n\n<p><strong>Time Complexity: <\/strong>O(N), where N is the size of the array<br><strong>Space Complexity: <\/strong>O(1), since no extra space is used.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-background has-black-background-color has-black-color is-style-wide\"\/>\n\n\n\n<p id=\"practice-questions\"><strong>Practice Questions<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.interviewbit.com\/problems\/kth-smallest-element-in-the-array\/\" target=\"_blank\" rel=\"noreferrer noopener\">Kth Smallest Element in the Array<\/a><\/p>\n\n\n\n<h2 id=\"faqs\">FAQs<\/h2>\n\n\n\n<ol><li><strong>Can a min-heap be used to solve Kth largest element?<\/strong><br>Yes, just like max heap, a min-heap can also be used to find the <strong>Kth<\/strong> largest element.<br><br><\/li><li><strong>What is the most efficient approach to solve the Kthlargest element?<\/strong><br>The <strong>quick select <\/strong>&nbsp;approach is the most efficient approach to solve the problem. The time complexity is O(N)&nbsp;<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"Problem Statement Given an integer array, A[] and an integer K. The task is to return the Kth&hellip;\n","protected":false},"author":5,"featured_media":3577,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_daextam_enable_autolinks":"","csco_singular_sidebar":"","csco_page_header_type":"","csco_appearance_grid":"","csco_page_load_nextpost":"","csco_post_video_location":[],"csco_post_video_location_hash":"","csco_post_video_url":"","csco_post_video_bg_start_time":0,"csco_post_video_bg_end_time":0},"categories":[145],"tags":[550],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/posts\/3536"}],"collection":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/comments?post=3536"}],"version-history":[{"count":7,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/posts\/3536\/revisions"}],"predecessor-version":[{"id":5727,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/posts\/3536\/revisions\/5727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/media\/3577"}],"wp:attachment":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/media?parent=3536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/categories?post=3536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/tags?post=3536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}