{"id":1220,"date":"2023-12-29T21:00:00","date_gmt":"2023-12-29T21:00:00","guid":{"rendered":"https:\/\/favtutor.com\/articles\/?p=1220"},"modified":"2024-01-01T05:21:29","modified_gmt":"2024-01-01T05:21:29","slug":"reverse-nodes-in-k-groups","status":"publish","type":"post","link":"https:\/\/favtutor.com\/articles\/reverse-nodes-in-k-groups\/","title":{"rendered":"Reverse List Nodes in K-Group (C++, Java, Python)"},"content":{"rendered":"\n<p>Linked lists contain a lot of problems, one of them is reversing the nodes of the list in the k groups. This task involves reversing k nodes at a time in a given linked list. In this article, we will discuss an approach to solve this famous leetcode problem and its implementation in C++, Java, and Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is Reverse Nodes in k-Group Problem?<\/strong><\/h2>\n\n\n\n<p><strong>In the Reverse List Nodes in K-Group problem, we are given a head of the linked list, and we are required to reverse the nodes in the k-group. <\/strong>The value of k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k, the left-out nodes at the end should remain unchanged.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p><strong>Input:<\/strong> List = [1,2,3,4,5,6,7,8]\u00a0<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/3kR_ThcGCL8i47magnXiEJbEqYFW_3clJdJgB-5IVksJPRKnJC76ouJ1skMSuDPXCUYn6OJ5oSfpG5emh2qRnK3H_HrfqMF3_MxOJ2n46trzpcMsWQOBJ9h2lUm1NayWGFRRg7Is3TlzZ5idIGOO0f0\" alt=\"Input List\"\/><\/figure>\n<\/div>\n\n\n<p>k=2<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/I0ITfIc7GaawhMarPExFUrxmsi0GdXy6-dFmgMnJK0mt0SMZO3YzOhvQGrXtdX96eZ2jB9Ddsb9cUkX1a2MqYJv6-emZGiz4OpyoiZuwbdi_tHctocORXYaRHVKBcbjyqRkW5LYWivT6QMgjSgHgaqc\" alt=\"Example of k = 2\"\/><\/figure>\n<\/div>\n\n\n<p><strong>Output:&nbsp;<\/strong><\/p>\n\n\n\n<p>[2,1,4,3,6,5,8,7]&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/-TCl1-cJYET76wZHOdA0Gf8rO3xYnKm1Ep_zNK7x8EIsk-JawGEyOTESfrZ4Hv4Zve2AD7i9zchTC7aKop77r3yLvKM79a-rIndnPTrAQ79bA_9ubNlOT7rb6kOBK3dTj_JQqx-i4_IkKSvjbAymIkY\" alt=\"Output list\"\/><\/figure>\n<\/div>\n\n\n<p>As we can see the nodes are reversed in the groups of 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Using 3 Pointers to Reverse Nodes in k-Group<\/strong><\/h2>\n\n\n\n<p><strong>To reverse nodes in k-group, we will use a systematic approach involving the creation of a dummy node and the use of three-pointers (pre, cur, and nex) for reversing each group.<\/strong><\/p>\n\n\n\n<p>Here are the steps involved in the solutions<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First of all, we will Iterate through the linked list to get the length of the list. This step is crucial for determining the number of groups to be processed.<\/li>\n\n\n\n<li>Now we will create a dummy node and point it next to the head of the given linked list. This dummy node will help in simplifying the edge cases.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/AWNhdOfjTEYnS9_bBH7C-yNnCJLK9wfZANhm_nHSfCCbakagWLcblynFylGOYc4sM8FYb-N56hVMH8c4Dt9zn8sBTJYTGSmOjaEZ_QgogO9PNZT-vsyoO82C_gVOzdgA_6cwCo0R0LniaX7uTwUG3x8\" alt=\"create a dummy node\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Now we will create three pointers: <strong>\u201cpre\u201d<\/strong>,<strong> \u201ccurr\u201d<\/strong>, and <strong>\u201cnex\u201d<\/strong> to facilitate the reversal of each group.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/2M-G9BtUyxer_1sOGThXauM-D4mG3HvP_cWrDXvW4YzNBqP0L4CAvkupbi7V98O_nZ9IKFfYM0vhrtuPl_jfGbf2ijzOrK2wtTcJF9z0p5hdB9rlsXDklq4qesHvT-YVPHNuo6hM0pR_5PezVFg1MNc\" alt=\"Initialize 3 pointers\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>We will iterate through the linked list until the length of the list to be processed is greater than or equal to the given k. This ensures that there are enough nodes in the remaining list to form a group of k nodes.<\/li>\n\n\n\n<li>Now for each iteration, we will point cur to pre-&gt;next and nex to nex-&gt;next and start a nested iteration for the length of k. For each inner iteration, modify the links in the following steps:\n<ul class=\"wp-block-list\">\n<li>cur-&gt;next = nex-&gt;next<\/li>\n\n\n\n<li>nex-&gt;next = pre-&gt;next<\/li>\n\n\n\n<li>pre-&gt;next = nex<\/li>\n\n\n\n<li>nex = cur-&gt;next<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>After k iteration, we will Move pre to cur and reduce the length by k. This process effectively reverses each group of k nodes.<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s see these steps in our example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Dummy node pointing to the head of the linked list<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/9s6mt-06fruX393U3XImOjURWN-_4W_BgY_9pnKgSKjzyK0lr8Rhcu9QQSRyFVG7BFuS43bMjBGVtIXv28QGDTjTO8NLZo2RTDa_hY-keJ-4bnvQtPqEs9nEGwwn7nTSniU2WI7IfOWPTyuzF9g5dUs\" alt=\"Pointing dummy node\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Now we will initialize pre = dummy head, curr = pre-&gt;next, and nex = curr-&gt;next<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/2M-G9BtUyxer_1sOGThXauM-D4mG3HvP_cWrDXvW4YzNBqP0L4CAvkupbi7V98O_nZ9IKFfYM0vhrtuPl_jfGbf2ijzOrK2wtTcJF9z0p5hdB9rlsXDklq4qesHvT-YVPHNuo6hM0pR_5PezVFg1MNc\" alt=\"Initialize pointers\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now we will change links,\n<ul class=\"wp-block-list\">\n<li>cur-&gt;next = nex-&gt;next<\/li>\n\n\n\n<li>nex-&gt;next = pre-&gt;next<\/li>\n\n\n\n<li>pre-&gt;next = nex<\/li>\n\n\n\n<li>nex = cur-&gt;next<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/IIjpZjEKxLIYBHYPHlbgFtvjvdEAmC6PQEkn2zy0o3RaycQ6TrTnB01K1QahRsVEyWBqfYPLIt0rVWlFPgc51yFuZDhVp2ACj5ob54soC5p87h5AbmplkZLZ13cIkW4XLcXayBNbP4w_PuOO7dS3djY\" alt=\"Change links\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Our first group is reversed now we will start reversing the second group by moving pre to curr and reducing the length by k. And using the same steps.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/H0KgYujUQfuVKq3FWWqPCRedW4IiaFULwT9tYiHrUgEksSLUQI0EHbBRcYaN13hYQaBP1O2lQ1ZZQ6d0JudykjT8Uf2YWISUMil85cZTP06RDB_4gDZinEBDpRSAhprSYhDaJyQ2wMQaz783bEprtJg\" alt=\"Reversing the second group\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now the second group is also reversed, we will move<strong> pre to curr<\/strong> and reduce length by k.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/8Vo3EXkZO_u9gNrfth3ZJGsxb4exhCb6YHejTgBitgjAbneiNM4u_antyW425p3pZ1Ix6gvG9BL1ePNdVWFmRv2uo_FRPtYdPG37c9P8P3lmeqgQpwwrnSOOqYycK6ND7ml5YPTt0yicEUu5jJolpv8\" alt=\"Reversing 3rd group\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now the third group is also reversed, we will move pre to curr and reduce length by k.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/RzieJ9qrhd23y0RojOnBPTt2w6gIOb85WhShCszJZBHmKtX5ZMG9OTPxno71yyN_KHjHrNCMNB3AcB_JZh2lKqC2RN8UXrh9X6McLPDbw55cyYpD2UiFY73JksDQiq1_RmMMn-xCZ1_RnchWnmAMH_4\" alt=\"Reversing 4th group\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now the fourth group is also reversed, we will move pre to curr and reduce length by k and here length becomes 0 so no more iteration.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now we will simply return the dummy&#8217;s next which is our modified linked list.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/-TCl1-cJYET76wZHOdA0Gf8rO3xYnKm1Ep_zNK7x8EIsk-JawGEyOTESfrZ4Hv4Zve2AD7i9zchTC7aKop77r3yLvKM79a-rIndnPTrAQ79bA_9ubNlOT7rb6kOBK3dTj_JQqx-i4_IkKSvjbAymIkY\" alt=\"Modified list\"\/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>C++ Code<\/strong><\/h3>\n\n\n\n<p>Here is the implementation in C++:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-c++src&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;C++&quot;,&quot;modeName&quot;:&quot;cpp&quot;}\">#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\n\n\/\/ Node class definition\nclass node {\npublic:\n    int num;\n    node* next;\n    node(int a) {\n        num = a;\n        next = NULL;\n    }\n};\n\n\/\/ Utility function to insert a node in the list\nvoid insertNode(node* &amp;head, int val) {\n    node* newNode = new node(val);\n    if (head == NULL) {\n        head = newNode;\n        return;\n    }\n\n    node* temp = head;\n    while (temp-&gt;next != NULL) temp = temp-&gt;next;\n\n    temp-&gt;next = newNode;\n    return;\n}\n\n\/\/ Utility function to find the length of the list\nint lengthOfLinkedList(node* head) {\n    int length = 0;\n    while (head != NULL) {\n        ++length;\n        head = head-&gt;next;\n    }\n    return length;\n}\n\n\/\/ Utility function to reverse k nodes in the list\nnode* reverseKNodes(node* head, int k) {\n    if (head == NULL || head-&gt;next == NULL) return head;\n\n    int length = lengthOfLinkedList(head);\n\n    \/\/ Create a dummy node to simplify edge cases\n    node* dummyHead = new node(0);\n    dummyHead-&gt;next = head;\n\n    \/\/ Pointers for reversing nodes\n    node* pre = dummyHead;\n    node* cur;\n    node* nex;\n\n    \/\/ Reverse k nodes at a time\n    while (length &gt;= k) {\n        cur = pre-&gt;next;\n        nex = cur-&gt;next;\n        \n        \/\/ Perform the reversal within a group of k nodes\n        for (int i = 1; i &lt; k; i++) {\n            cur-&gt;next = nex-&gt;next;\n            nex-&gt;next = pre-&gt;next;\n            pre-&gt;next = nex;\n            nex = cur-&gt;next;\n        }\n\n        \/\/ Move pre to the end of the reversed group\n        pre = cur;\n        length -= k;\n    }\n\n    \/\/ Return the modified list\n    return dummyHead-&gt;next;\n}\n\n\/\/ Utility function to print the list\nvoid printLinkedList(node* head) {\n    while (head-&gt;next != NULL) {\n        cout &lt;&lt; head-&gt;num &lt;&lt; &quot;-&gt;&quot;;\n        head = head-&gt;next;\n    }\n    cout &lt;&lt; head-&gt;num &lt;&lt; &quot;\\n&quot;;\n}\n\nint main() {\n    node* head = NULL;\n\n    int k = 2;  \/\/ Change the value of k to 2\n\n    \/\/ Inserting nodes into the linked list\n    insertNode(head, 1);\n    insertNode(head, 2);\n    insertNode(head, 3);\n    insertNode(head, 4);\n    insertNode(head, 5);\n    insertNode(head, 6);\n    insertNode(head, 7);\n    insertNode(head, 8);\n\n    \/\/ Displaying the original linked list\n    cout &lt;&lt; &quot;Original Linked List: &quot;;\n    printLinkedList(head);\n\n    \/\/ Reversing k nodes in the linked list\n    cout &lt;&lt; &quot;After Reversal of k nodes: &quot;;\n    node* newHead = reverseKNodes(head, k);\n    printLinkedList(newHead);\n\n    return 0;\n}<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Python Code<\/strong><\/h3>\n\n\n\n<p>You can do this in Python as well:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;Python&quot;,&quot;modeName&quot;:&quot;python&quot;}\">class ListNode:\n    def __init__(self, x):\n        self.num = x\n        self.next = None\n\ndef insertNode(head, val):\n    new_node = ListNode(val)\n    if head is None:\n        head = new_node\n        return head\n\n    temp = head\n    while temp.next is not None:\n        temp = temp.next\n\n    temp.next = new_node\n    return head\n\ndef length_of_linked_list(head):\n    length = 0\n    while head is not None:\n        length += 1\n        head = head.next\n    return length\n\ndef reverse_k_nodes(head, k):\n    if head is None or head.next is None:\n        return head\n\n    length = length_of_linked_list(head)\n\n    dummy_head = ListNode(0)\n    dummy_head.next = head\n\n    pre = dummy_head\n    cur = None\n    nex = None\n\n    while length &gt;= k:\n        cur = pre.next\n        nex = cur.next\n\n        for i in range(1, k):\n            cur.next = nex.next\n            nex.next = pre.next\n            pre.next = nex\n            nex = cur.next\n\n        pre = cur\n        length -= k\n\n    return dummy_head.next\n\ndef print_linked_list(head):\n    while head.next is not None:\n        print(head.num, end=&quot;-&gt;&quot;)\n        head = head.next\n    print(head.num)\n\nif __name__ == &quot;__main__&quot;:\n    head = None\n    k = 2  # Change the value of k to 2\n\n    # Inserting nodes into the linked list\n    head = insertNode(head, 1)\n    head = insertNode(head, 2)\n    head = insertNode(head, 3)\n    head = insertNode(head, 4)\n    head = insertNode(head, 5)\n    head = insertNode(head, 6)\n    head = insertNode(head, 7)\n    head = insertNode(head, 8)\n\n    # Displaying the original linked list\n    print(&quot;Original Linked List: &quot;, end=&quot;&quot;)\n    print_linked_list(head)\n\n    # Reversing k nodes in the linked list\n    print(&quot;After Reversal of k nodes: &quot;, end=&quot;&quot;)\n    new_head = reverse_k_nodes(head, k)\n    print_linked_list(new_head)<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Java Code<\/strong><\/h3>\n\n\n\n<p>Here is the Java program to reverse nodes in k Group:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;Java&quot;,&quot;modeName&quot;:&quot;java&quot;}\">import java.util.*;\n public class favtutor {\n     static class Node {\n    int num;\n    Node next;\n\n    Node(int a) {\n        num = a;\n        next = null;\n    }\n}\n    \/\/ Utility function to insert node in the list\n    static Node insertNode(Node head, int val) {\n        Node newNode = new Node(val);\n        if (head == null) {\n            head = newNode;\n            return head;\n        }\n\n        Node temp = head;\n        while (temp.next != null)\n            temp = temp.next;\n\n        temp.next = newNode;\n        return head;\n    }\n\n    \/\/ Utility function to find length of the list\n    static int lengthOfLinkedList(Node head) {\n        int length = 0;\n        while (head != null) {\n            ++length;\n            head = head.next;\n        }\n        return length;\n    }\n\n    \/\/ Utility function to reverse k nodes in the list\n    static Node reverseKNodes(Node head, int k) {\n        if (head == null || head.next == null)\n            return head;\n\n        int length = lengthOfLinkedList(head);\n\n        Node dummyHead = new Node(0);\n        dummyHead.next = head;\n\n        Node pre = dummyHead;\n        Node cur;\n        Node nex;\n\n        while (length &gt;= k) {\n            cur = pre.next;\n            nex = cur.next;\n            for (int i = 1; i &lt; k; i++) {\n                cur.next = nex.next;\n                nex.next = pre.next;\n                pre.next = nex;\n                nex = cur.next;\n            }\n            pre = cur;\n            length -= k;\n        }\n        return dummyHead.next;\n    }\n\n    \/\/ Utility function to print the list\n    static void printLinkedList(Node head) {\n        while (head.next != null) {\n            System.out.print(head.num + &quot;-&gt;&quot;);\n            head = head.next;\n        }\n        System.out.println(head.num);\n    }\n\n    public static void main(String args[]) {\n        Node head = null;\n        int k = 3;\n        head = insertNode(head, 1);\n        head = insertNode(head, 2);\n        head = insertNode(head, 3);\n        head = insertNode(head, 4);\n        head = insertNode(head, 5);\n        head = insertNode(head, 6);\n        head = insertNode(head, 7);\n        head = insertNode(head, 8);\n\n        System.out.print(&quot;Original Linked List: &quot;);\n        printLinkedList(head);\n        System.out.print(&quot;After Reversal of k nodes: &quot;);\n        Node newHead = reverseKNodes(head, k);\n        printLinkedList(newHead);\n\n    }\n}<\/pre><\/div>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-background\" style=\"background-color:#fedcba\"><code>Original Linked List: 1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;6-&gt;7-&gt;8\nAfter Reversal of k nodes: 2-&gt;1-&gt;4-&gt;3-&gt;6-&gt;5-&gt;8-&gt;7<\/code><\/pre>\n\n\n\n<p>The time complexity for this approach is O(N) because the main loop iterates through the linked list, reversing k nodes at a time. In the worst case, each node is visited and reversed exactly once. Since the number of nodes is N, this process also takes O(N) time. The space complexity for this approach is O(1) as no extra space is used.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>In conclusion, the <a href=\"https:\/\/leetcode.com\/problems\/reverse-nodes-in-k-group\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/leetcode.com\/problems\/reverse-nodes-in-k-group\/\" rel=\"noreferrer noopener nofollow\">leetcode problem<\/a> of reversing nodes in k-groups within a linked list has been discussed and solved using an optimized approach. The article covered the implementation of the solution in C++, Java, and Python with their complexity analysis. Need more help? get <a href=\"https:\/\/favtutor.com\/data-structures-assignment-help\" data-type=\"link\" data-id=\"https:\/\/favtutor.com\/data-structures-assignment-help\">Data Structures assignment help online<\/a> from top experts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linked lists contain a lot of problems, one of them is reversing the nodes of the list in the k groups. This task involves reversing k nodes at a time in a given linked list. In this article, we will discuss an approach to solve this famous leetcode problem and its implementation in C++, Java, [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":1222,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jnews-multi-image_gallery":[],"jnews_single_post":null,"jnews_primary_category":{"id":"","hide":""},"footnotes":""},"categories":[7],"tags":[14,15],"class_list":["post-1220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structures-algorithms","tag-dsa","tag-leetcode"],"_links":{"self":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/1220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/comments?post=1220"}],"version-history":[{"count":3,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/1220\/revisions"}],"predecessor-version":[{"id":1261,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/1220\/revisions\/1261"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/media\/1222"}],"wp:attachment":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/media?parent=1220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/categories?post=1220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/tags?post=1220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}