{"id":1279,"date":"2020-06-10T19:10:52","date_gmt":"2020-06-10T19:10:52","guid":{"rendered":"https:\/\/blog.prepbytes.com\/?p=1279"},"modified":"2022-03-30T22:15:32","modified_gmt":"2022-03-30T22:15:32","slug":"salvation-of-soul","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/","title":{"rendered":"Salvation of Soul"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\" alt=\"\" \/><\/p>\n<h3>Concepts Used<\/h3>\n<blockquote>\n<p>Sorting<\/p>\n<\/blockquote>\n<h3>Difficulty Level<\/h3>\n<blockquote>\n<p>Medium<\/p>\n<\/blockquote>\n<h3>Problem Statement (Simplified):<\/h3>\n<blockquote>\n<p>For a given array, shift elements to the back of array until you get the minimum value of the whole array, repeat until the whole array is emptied. Find such a total number of steps and print.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/mycode.prepbytes.com\/problems\/sorting\/SALSOUL\" title=\"Go to mycode.prepbytes.com\" target=\"_blank\" rel=\"noopener noreferrer\"><u><strong><\/strong><\/u><\/a><\/p>\n<h4>Test case<\/h4>\n<p>Input:<br \/>\n4<br \/>\n8 5 2 3<\/p>\n<p>Output:<br \/>\n7<\/p>\n<h3>Explanation:<\/h3>\n<p>In the given example [8,5,2,3], the minimum value of bad deed is 2.<\/p>\n<ol>\n<li>God first looks at the soul having value 8 on it, he sends him to the end of the queue as 8!=2. Updated line &#8211; [5,2,3,8].<\/li>\n<li>God looks at the soul having value 5 on it, he sends him to the end of the queue as 5!=2. Updated line &#8211; [2,3,8,5]. <\/li>\n<li>God looks at the soul having value 2 on it, he gives Salvation to this soul because 2==2. Updated line &#8211; [3,8,5] and the new minimum value is 3.<\/li>\n<li>God looks at the soul having value 3 on it, he gives salvation to this soul because 3==3. Updated line &#8211; [8,5] and the new minimum value is 5.<\/li>\n<li>God looks at the soul having value 8 on it, he sends him to the end of the queue as 8!=5. Updated line &#8211; [5,8].<\/li>\n<li>God looks at the soul having value 5 on it, he gives salvation to this soul because 5==5. Updated line &#8211; [8] and the new minimum value is 8.<\/li>\n<li>\n<p>God looks at the soul having value 8 on it, he gives Salvation to this soul because 8==8. Updated line &#8211; Empty.<\/p>\n<p>Finally, all souls received salvation.<br \/>\nThus, the total number of times God selects the souls is 7.<\/p>\n<\/li>\n<\/ol>\n<h3>Solving Approach :<\/h3>\n<h4>Bruteforce Approach:<\/h4>\n<blockquote>\n<p>1) We can create a duplicate array of current array and sort it. So, this array will give us the current minimum value in the array.<br \/>\n2) Now we will traverse on our main array until whole elements from a duplicate array are traversed. With every traversal, if the current element is not <code>-1<\/code>, we add <code>1<\/code> to total steps. If the item is the current smallest, we make the element <code>-1<\/code>, move the pointer of duplicate sorted array to the next element.<br \/>\n3) If we reach the end of our main array, we move the pointer to the first element of the array.<br \/>\n3) After the whole array is traversed, we print the total number of steps.<br \/>\n4) This approach takes O(N<sup>2<\/sup>) in the worst case, which is highly inefficient for given constraints.<\/p>\n<\/blockquote>\n<h4>Efficient Approach:<\/h4>\n<blockquote>\n<p>1) We can solve this problem if we know all positions of any element in the array, so we can maintain a set or a 2-D array where <code>row<\/code> represents an element in the array, and <code>columns<\/code> contains indexes at which the number is present.<br \/>\n2) We start from the least value (Minimum  value of all elements) of the array to greatest (Maximum value of all elements) value in the array, so that it will be easy to remove and calculate distance easily.<br \/>\n3) We traverse for all indexes of an element, in each traversal we check the farthest position of the element from our current position, where current position changes after every element is traversed completely.<br \/>\n4) If during traversal our ending position crosses the current position, we add the size of the array to solution as the whole array was traversed.<br \/>\n5) Also we add the total number of appearances of the current element to the final answer because deleting each element once also consumes one step.<br \/>\n6) We decrease the final size of the array by a number of appearances of the traversed element as they&#8217;ll be removed after it&#8217;s all position are traversed.<br \/>\n7) We apply the same for all elements. In end, we print the final answer.<\/p>\n<\/blockquote>\n<h3>Example<\/h3>\n<blockquote>\n<ul>\n<li>Lets assume array <code>[1,2,3,3,1]<\/code> as our array, if we note all its elements with indexes, we can see <code>1<\/code> appears at index <code>0<\/code> and <code>4<\/code>, <code>2<\/code> appears at index <code>1<\/code> and <code>3<\/code>,  <code>3<\/code> appears only at index <code>2<\/code>. <\/li>\n<li>If we start from index <code>0<\/code>, and traverse elements from least to greatest, so we&#8217;ll traverse first for <code>1<\/code>, then <code>2<\/code> and <code>3<\/code> finally.<\/li>\n<li>We traverse <code>1<\/code> first, we can see our starting position is <code>0<\/code>, but the last value of <code>1<\/code> appears at index <code>4<\/code>, so our ending position becomes <code>4<\/code>. As we never iterated the whole array, we&#8217;ll add only <code>2<\/code> to solution i.e. number of appearances of <code>1<\/code> in the array. So the answer becomes <code>2<\/code>.<\/li>\n<li>After removing <code>1<\/code> our array size becomes <code>5-2<\/code> i.e. <code>3<\/code> and our starting position becomes <code>4<\/code>.<\/li>\n<li>We traverse <code>2<\/code> now, we can see our starting position is <code>4<\/code>, but the last value of <code>2<\/code> appears at index <code>3<\/code>, so our ending position becomes <code>3<\/code>. As ending position is smaller than starting position so we add whole array size to solution too because, in this case, we iterated the whole array. Answer becomes <code>2+3<\/code> i.e. <code>5<\/code>. We&#8217;ll also add <code>2<\/code> to solution i.e. number of appearances of <code>2<\/code> in the array. So the answer becomes <code>5+2<\/code> i.e. <code>7<\/code>.<\/li>\n<li>After removing <code>2<\/code> our array size becomes <code>3-2<\/code> i.e. <code>1<\/code> and our starting position becomes <code>3<\/code>.<\/li>\n<li>We traverse <code>3<\/code> now, we can see our starting position is <code>3<\/code>, but the last value of <code>3<\/code> appears at index <code>2<\/code>, so our ending position becomes <code>2<\/code>. As ending position is smaller than starting position so we add whole array size to the solution too because, in this case, we iterated the whole array. Answer becomes <code>7+1<\/code> i.e. <code>8<\/code>. We&#8217;ll also add <code>1<\/code> to solution i.e. number of appearances of <code>1<\/code> in the array. So answer becomes <code>8+1<\/code> i.e. <code>9<\/code>.<\/li>\n<li>After removing <code>1<\/code> our array size becomes <code>1-1<\/code> i.e. <code>0<\/code>. As the whole array has been iterated and size of the array becomes <code>0<\/code>. We stop traversal.<\/li>\n<li>Our final answer value is <code>9<\/code>, so we print <code>9<\/code> as our answer.<\/li>\n<\/ul>\n<\/blockquote>\n<h3>Solutions<\/h3>\n<p>\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_1344 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_1344 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_1344 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_1344 .wpsm_nav-tabs > li.active > a, #tab_container_1344 .wpsm_nav-tabs > li.active > a:hover, #tab_container_1344 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_1344 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_1344 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_1344 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_1344 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_1344 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_1344 .wpsm_nav-tabs > li > a:hover , #tab_container_1344 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_1344 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_1344 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_1344 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_1344 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_1344 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_1344 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_1344 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_1344 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_1344 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_1344 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_1344 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_1344\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_1344\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_1344_1\" aria-controls=\"tabs_desc_1344_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_1344_2\" aria-controls=\"tabs_desc_1344_2\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C++<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_1344_3\" aria-controls=\"tabs_desc_1344_3\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Java<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_1344_4\" aria-controls=\"tabs_desc_1344_4\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Python<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_1344\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_1344_1\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"c\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n\r\n#include &lt;stdio.h&gt;\r\nint positions[100001][5000];\r\nint ind[100001]={0};\r\n\r\nint main()\r\n{\r\n    int n;\r\n    scanf(&quot;%d&quot;,&amp;n);\r\n\r\n    int startingSouls = n;\r\n    int arr[n];\r\n\r\n    for(int i=0; i&lt;n;i++){\r\n        scanf(&quot;%d&quot;,&amp;arr[i]);\r\n        positions[arr[i]][ind[arr[i]]++] =  i;\r\n    }\r\n\r\n    long solution = 0;\r\n    int curPos = 0;\r\n\r\n    for(int i=0; i&lt;100001; i++){\r\n        int endPos = curPos;\r\n        int worst = -1;\r\n\r\n        for(int j=0; j&lt;ind[i];j++){\r\n            int pos  = positions[i][j];\r\n            int checks = (pos - curPos) % startingSouls;\r\n            if (checks &lt; 0)\r\n            {\r\n                checks += startingSouls;\r\n            }\r\n            if (curPos &gt; pos) {\r\n                solution++;\r\n            }\r\n            if (checks &gt; worst) {\r\n                worst = checks;\r\n                endPos = pos;\r\n            }\r\n        }\r\n        if (curPos &gt; endPos) {\r\n                solution += n;\r\n            }else {\r\n                solution += ind[i];\r\n            }\r\n            n -= ind[i];\r\n            curPos = endPos;\r\n    }\r\n    printf(&quot;%ld&#92;n&quot;,solution);\r\n\r\n}\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\r\n\r\n\r\n\r\n\r\n\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_1344_2\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"cpp\"} -->\r\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=\"\">\r\n#include &amp;lt;bits\/stdc++.h&amp;gt;\r\nusing namespace std;\r\n\r\nint positions[100001][5000];\r\nint ind[100001]={0};\r\n\r\nint main()\r\n{\r\n    int n;\r\n    cin&amp;gt;&amp;gt;n;\r\n\r\n    int startingSouls = n;\r\n    int arr[n];\r\n\r\n    for(int i=0; i&amp;lt;n;i++){\r\n        cin&amp;gt;&amp;gt;arr[i];\r\n        positions[arr[i]][ind[arr[i]]++] =  i;\r\n    }\r\n\r\n    long solution;\r\n    int curPos;\r\n\r\n    for(int i=0; i&amp;lt;100001; i++){\r\n        int endPos = curPos;\r\n        int worst = -1;\r\n\r\n        for(int j=0; j&amp;lt;ind[i];j++){\r\n            int pos  = positions[i][j];\r\n            int checks = (pos - curPos) % startingSouls;\r\n            if (checks &amp;lt; 0)\r\n            {\r\n                checks += startingSouls;\r\n            }\r\n            if (curPos &amp;gt; pos) {\r\n                solution++;\r\n            }\r\n            if (checks &amp;gt; worst) {\r\n                worst = checks;\r\n                endPos = pos;\r\n            }\r\n        }\r\n        if (curPos &amp;gt; endPos) {\r\n                solution += n;\r\n            }else {\r\n                solution += ind[i];\r\n            }\r\n            n -= ind[i];\r\n            curPos = endPos;\r\n    }\r\n    cout&amp;lt;&amp;lt;solution&amp;lt;&amp;lt;endl;\r\n\r\n}\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_1344_3\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"java\"} -->\r\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=\"\">\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n    public static void main(String[] args) throws IOException {\r\n        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n        int n = Integer.parseInt(br.readLine());\r\n        int startingSouls = n;\r\n        String[] SoulsStr = br.readLine().split(&quot; &quot;);\r\n        @SuppressWarnings(&quot;unchecked&quot;)\r\n        ArrayList&amp;lt;Integer&amp;gt;[] positions = (ArrayList&amp;lt;Integer&amp;gt;[]) new ArrayList[100001];\r\n        for (int i = 0; i &amp;lt; positions.length; i++) {\r\n            positions[i] = new ArrayList&amp;lt;Integer&amp;gt;();\r\n        }\r\n        for (int i = 0; i &amp;lt; n; i++) {\r\n            int value = Integer.parseInt(SoulsStr[i]);\r\n            positions[value].add(i);\r\n        }\r\n        long solution = 0;\r\n        int curPos = 0;\r\n        for (int i = 1; i &amp;lt; positions.length; i++) {\r\n            int endPos = curPos;\r\n            int worst = -1;\r\n            for (int j = 0; j &amp;lt; positions[i].size(); j++) {\r\n                int pos = positions[i].get(j);\r\n                int checks = (pos - curPos) % startingSouls;\r\n                if (checks &amp;lt; 0)\r\n                {\r\n                    checks += startingSouls;\r\n                }\r\n                if (curPos &amp;gt; pos) {\r\n                    solution++;\r\n                }\r\n                if (checks &amp;gt; worst) {\r\n                    worst = checks;\r\n                    endPos = pos;\r\n                }\r\n            }\r\n            if (curPos &amp;gt; endPos) {\r\n                solution += n;\r\n            }else {\r\n                solution += positions[i].size();\r\n            }\r\n            n -= positions[i].size();\r\n            curPos = endPos;\r\n        }\r\n        System.out.println(solution);\r\n    }\r\n}\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_1344_4\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"Python\"} -->\r\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=\"\">\r\nprimes = [0] * 100006\r\n\r\ndef setPrimes():\r\n\r\n\tglobal primes\r\n\r\n\tfor i in range(2, 100006):\r\n\t\tprimes[i] = 1\r\n\r\n\tprimes[0] = 0\r\n\tprimes[1] = 0\r\n\r\n\tfor i in range(2, 100006):\r\n\r\n\t\tfor j in range(2 * i, 100006, i):\r\n\t\t\tprimes[j] = 0\r\n\r\nsetPrimes()\r\nfor _ in range(int(input())):\r\n\r\n\tn = int(input())\r\n\tsum = 0\r\n\ti = 2\r\n\r\n\twhile(n!=0):\r\n\t\tif( primes[i] == 1 ):\r\n\t\t\tk = i\r\n\t\t\todd = 0\r\n\t\t\twhile(k):\r\n\t\t\t\tif(primes[k % 10] == 1 and k % 10 != 2):\r\n\t\t\t\t\todd = 1\r\n\t\t\t\t\tbreak\r\n\t\t\t\t\r\n\t\t\t\tk\/\/=10\r\n\t\t\t\r\n\t\t\tif(odd == 0):\r\n\t\t\t\tsum += i\r\n\t\t\t\tn -= 1\r\n\r\n\t\ti += 1\r\n\r\n\tprint(sum)\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_1344 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_1344 a\"),jQuery(\"#tab-content_1344\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t<br \/>\n<strong>Space Complexity<\/strong> O(<code>1000001<\/code>) space is taken to maintain a <code>Position<\/code> <code>Array<\/code>.<\/p>\n<p>[forminator_quiz id=&quot;1352&quot;]<\/p>\n<p>This article tried to discuss the concept of <strong>sorting<\/strong>. Hope this blog helps you understand and solve the problem. To practice more problems on sorting you can check out <a href=\"#\"><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Concepts Used Sorting Difficulty Level Medium Problem Statement (Simplified): For a given array, shift elements to the back of array until you get the minimum value of the whole array, repeat until the whole array is emptied. Find such a total number of steps and print. Test case Input: 4 8 5 2 3 Output: [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[92],"tags":[36,91],"class_list":["post-1279","post","type-post","status-publish","format-standard","hentry","category-sorting-interview-programming","tag-interview-coding","tag-sorting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Sorting Interview Programming | Salvation of Soul | Prepbytes<\/title>\n<meta name=\"description\" content=\"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sorting Interview Programming | Salvation of Soul | Prepbytes\" \/>\n<meta property=\"og:description\" content=\"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-10T19:10:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-30T22:15:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Salvation of Soul\",\"datePublished\":\"2020-06-10T19:10:52+00:00\",\"dateModified\":\"2022-03-30T22:15:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\"},\"wordCount\":937,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\",\"keywords\":[\"interview-coding\",\"Sorting\"],\"articleSection\":[\"Sorting interview programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\",\"name\":\"Sorting Interview Programming | Salvation of Soul | Prepbytes\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\",\"datePublished\":\"2020-06-10T19:10:52+00:00\",\"dateModified\":\"2022-03-30T22:15:32+00:00\",\"description\":\"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sorting interview programming\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/sorting-interview-programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Salvation of Soul\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sorting Interview Programming | Salvation of Soul | Prepbytes","description":"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.","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:\/\/prepbytes.com\/blog\/salvation-of-soul\/","og_locale":"en_US","og_type":"article","og_title":"Sorting Interview Programming | Salvation of Soul | Prepbytes","og_description":"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.","og_url":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2020-06-10T19:10:52+00:00","article_modified_time":"2022-03-30T22:15:32+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Salvation of Soul","datePublished":"2020-06-10T19:10:52+00:00","dateModified":"2022-03-30T22:15:32+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/"},"wordCount":937,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png","keywords":["interview-coding","Sorting"],"articleSection":["Sorting interview programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/","url":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/","name":"Sorting Interview Programming | Salvation of Soul | Prepbytes","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png","datePublished":"2020-06-10T19:10:52+00:00","dateModified":"2022-03-30T22:15:32+00:00","description":"For a Given Array, Shift Elements to the Back of Array Until You Get the Minimum Value of the Whole Array, Repeat Until the Whole Array Is Emptied.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/salvation-of-soul\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645182104889-Article_478.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/salvation-of-soul\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Sorting interview programming","item":"https:\/\/prepbytes.com\/blog\/category\/sorting-interview-programming\/"},{"@type":"ListItem","position":3,"name":"Salvation of Soul"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/1279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=1279"}],"version-history":[{"count":8,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/1279\/revisions"}],"predecessor-version":[{"id":8381,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/1279\/revisions\/8381"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=1279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=1279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=1279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}