{"id":14553,"date":"2022-11-24T19:09:53","date_gmt":"2022-11-24T13:39:53","guid":{"rendered":"https:\/\/www.interviewbit.com\/blog\/?post_type=web-story&#038;p=14553"},"modified":"2022-11-24T19:09:54","modified_gmt":"2022-11-24T13:39:54","slug":"travelling-salesman-problem","status":"publish","type":"web-story","link":"https:\/\/www.interviewbit.com\/blog\/web-stories\/travelling-salesman-problem\/","title":{"rendered":"Travelling Salesman Problem"},"content":{"rendered":"<p><html amp=\"\" lang=\"en\"><head><meta charSet=\"utf-8\"\/><meta name=\"viewport\" content=\"width=device-width,minimum-scale=1,initial-scale=1\"\/><script async=\"\" src=\"https:\/\/cdn.ampproject.org\/v0.js\"><\/script><script async=\"\" src=\"https:\/\/cdn.ampproject.org\/v0\/amp-story-1.0.js\" custom-element=\"amp-story\"><\/script><link href=\"https:\/\/fonts.googleapis.com\/css2?display=swap&amp;family=Merriweather%3Awght%40700&amp;family=Roboto&amp;family=Darker+Grotesque%3Awght%40400%3B700&amp;family=Anton\" rel=\"stylesheet\"\/><link href=\"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=5304&amp;h=7952&amp;fit=max\" rel=\"preload\" as=\"image\"\/>\n<style amp-boilerplate=\"\">body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}<\/style>\n<p><noscript><\/p>\n<style amp-boilerplate=\"\">body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}<\/style>\n<p><\/noscript><\/p>\n<style amp-custom=\"\">\n              h1, h2, h3 { font-weight: normal; }<\/p>\n<p>              amp-story-page {\n                background-color: #131516;\n              }<\/p>\n<p>              amp-story-grid-layer {\n                overflow: visible;\n              }<\/p>\n<p>              @media (max-aspect-ratio: 9 \/ 16)  {\n                @media (min-aspect-ratio: 320 \/ 678) {\n                  amp-story-grid-layer.grid-layer {\n                    margin-top: calc((100% \/ 0.5625 - 100% \/ 0.6666666666666666) \/ 2);\n                  }\n                }\n              }<\/p>\n<p>              @media not all and (min-resolution:.001dpcm) {\n                @media {\n                  p.text-wrapper > span {\n                    font-size: calc(100% - 0.5px);\n                  }\n                }\n              }<\/p>\n<p>              .page-fullbleed-area,\n              .page-background-overlay-area {\n                position: absolute;\n                overflow: hidden;\n                width: 100%;\n                left: 0;\n                height: calc(1.1851851851851851 * 100%);\n                top: calc((1 - 1.1851851851851851) * 100% \/ 2);\n              }<\/p>\n<p>              .element-overlay-area {\n                position: absolute;\n                width: 100%;\n                height: 100%;\n                top: 0;\n                left: 0;\n              }<\/p>\n<p>              .page-safe-area {\n                overflow: visible;\n                position: absolute;\n                top: 0;\n                bottom: 0;\n                left: 0;\n                right: 0;\n                width: 100%;\n                height: calc(0.84375 * 100%);\n                margin: auto 0;\n              }<\/p>\n<p>              .mask {\n                position: absolute;\n                overflow: hidden;\n              }<\/p>\n<p>              .fill {\n                position: absolute;\n                top: 0;\n                left: 0;\n                right: 0;\n                bottom: 0;\n                margin: 0;\n              }<\/p>\n<p>              @media (prefers-reduced-motion: no-preference) {\n                .animation-wrapper {\n                  opacity: var(--initial-opacity);\n                  transform: var(--initial-transform);\n                }\n              }<\/p>\n<p>              amp-story-grid-layer.align-bottom {\n                align-content: end;\n                padding: 0;\n              }<\/p>\n<p>              .captions-area {\n                padding: 0 32px 0;\n              }<\/p>\n<p>              amp-story-captions {\n                margin-bottom: 16px;\n                text-align: center;\n              }<\/p>\n<p>              amp-story-captions span {\n                display: inline-block;\n                margin: 0;\n                padding: 6px 12px;\n                vertical-align: middle;\n                border-radius: 15px;\n                background: rgba(11, 11, 11, 0.6);\n                color: rgba(255, 255, 255, 1);\n                font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;;\n                font-size: calc(4 * var(--story-page-vw));\n                line-height: 1.4;\n                word-break: break-word;\n                word-wrap: break-word;\n                overflow-wrap: break-word;\n              }\n              <\/style>\n<p><meta name=\"web-stories-replace-head-start\"\/><title>Travelling Salesman Problem<\/title><link rel=\"canonical\" href=\"https:\/\/www.interviewbit.com\/blog\/?post_type=web-story&amp;p=14553\"\/><meta name=\"web-stories-replace-head-end\"\/><\/head><body><amp-story standalone=\"\" publisher=\"InterviewBit\" publisher-logo-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/cropped-tumblr-logo.png\" title=\"Travelling Salesman Problem\" poster-portrait-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2022\/11\/cropped-travelling_salesman_problems.png\"><amp-story-page id=\"2ba48566-4303-4648-be14-d8b890969253\" auto-advance-after=\"7s\"><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#c0c0c0\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-22ae990b-24ec-4f61-9792-67850d36d3d5\">\n<div style=\"position:absolute;width:118.57814%;height:100%;left:-9.28907%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=5304&amp;h=7952&amp;fit=max\" alt=\"men sitting in front of their laptop computer\" srcSet=\"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=5304&amp;h=7952&amp;fit=max 5304w,https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4243&amp;h=6361&amp;fit=max 4243w,https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3182&amp;h=4771&amp;fit=max 3182w,https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2121&amp;h=3180&amp;fit=max 2121w,https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1060&amp;h=1589&amp;fit=max 1060w,https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=510&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 53vh, 119vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-84a9fe46-f171-471f-bb69-fb55fff093d6\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:8.25243%;top:39.96764%;width:83.00971%;height:29.44984%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5847953216374269% 0.5847953216374269% 0.5847953216374269% 0.5847953216374269% \/ 1.098901098901099% 1.098901098901099% 1.098901098901099% 1.098901098901099%\" id=\"el-5a03f828-20ca-4b52-b11f-7a23ec19dee9\">\n<h1 id=\"travelling-salesman-problem\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.48976608187134424% 0;font-family:&quot;Merriweather&quot;,serif;font-size:0.809061em;line-height:1.19;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #fff\">Travelling Salesman Problem<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:9.95146%;top:92.23301%;width:80.09709%;height:13.26861%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-6f338729-862c-4acf-9ed6-e37e14299c8a\">\n<div style=\"position:absolute;width:100%;height:107.47869%;left:0%;top:-3.73934%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAi\/fl%C3%A8che-arrow.gif\" alt=\"Fl\u00e8che Arrow Sticker\" srcSet=\"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAi\/fl%C3%A8che-arrow.gif 498w,https:\/\/media.tenor.com\/cgriPG-ob9QAAAAk\/fl%C3%A8che-arrow.gif 90w\" sizes=\"(min-width: 1024px) 36vh, 80vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:8.73786%;top:71.84466%;width:79.85437%;height:5.66343%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.60790273556231% 0.60790273556231% 0.60790273556231% 0.60790273556231% \/ 5.714285714285714% 5.714285714285714% 5.714285714285714% 5.714285714285714%\" id=\"el-5b15132f-f6e9-4720-9e5a-c23a5493346d\">\n<h2 id=\"a-quick-overview\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:-0.12822948328267478% 0;font-family:&quot;Roboto&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #e06e04\">A Quick Overview<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><\/amp-story-page><amp-story-page id=\"47ddb9f2-270d-4b0d-993f-122d8b97f3fb\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-05c46677-84ff-487b-9525-eab35270d7b2\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-f4289908-6df8-4506-99ce-23a719fd898a\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-b593b878-727e-4094-9828-eb231dc97b18\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-c3636f99-418f-4f01-b4d2-e9fe56d52946\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-9a009b0f-984c-47b0-ad97-5f4f53472a86 [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#f3d9a6\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-9a009b0f-984c-47b0-ad97-5f4f53472a86\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-783eb30d-5544-49d0-ba8f-e169faf92c1a\">\n<div style=\"position:absolute;width:266.31253%;height:100%;left:-83.15627%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"three women beside table looking at MacBook\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:9.2233%;top:30.74434%;width:84.95146%;height:9.87055%;opacity:1\">\n<div id=\"anim-05c46677-84ff-487b-9525-eab35270d7b2\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-f4289908-6df8-4506-99ce-23a719fd898a\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5714285714285714% 0.5714285714285714% 0.5714285714285714% 0.5714285714285714% \/ 3.278688524590164% 3.278688524590164% 3.278688524590164% 3.278688524590164%\" id=\"el-7cd230c0-4238-4ec5-adce-927aef7b27e4\">\n<h1 id=\"problem-statement\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.931428571428572% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.728155em;line-height:0.9;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Problem Statement<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:9.95146%;top:45.14563%;width:81.79612%;height:33.17152%;transform:rotate(360deg);opacity:1\">\n<div id=\"anim-b593b878-727e-4094-9828-eb231dc97b18\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-c3636f99-418f-4f01-b4d2-e9fe56d52946\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5934718100890208% 0.5934718100890208% 0.5934718100890208% 0.5934718100890208% \/ 0.975609756097561% 0.975609756097561% 0.975609756097561% 0.975609756097561%\" id=\"el-7bb8f5a3-dbd4-41bc-9727-7be2fd18d627\">\n<h2 id=\"given-a-set-of-cities-and-distance-between-every-pair-of-cities-as-an-adjacency-matrix-the-problem-is-to-find-shortest-route-that-visits-all-cities-exactly-once-and-returns-to-starting-point\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.648071216617211% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">Given a set of cities and distance between every pair of cities as an adjacency matrix, the problem is to find shortest route that visits all cities exactly once and returns to starting point.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-fc6c6249-6fbf-4dbc-a29e-1a11b2b9d388\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"becbb31f-aa34-4058-b76e-6f59d68a9dae\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-b88aedb0-1090-4fe2-a348-cb9bb35e2988\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-89961301-7f91-4548-ab10-dc6b5d455c49\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-7a30a35e-e2ed-485d-85a3-13f01c8e383b [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-8e9bf8bc-bdda-4059-a580-095f97f87b4f\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-abb314e8-f556-4aa3-9929-8a225a0b12f1\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#262626\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-7a30a35e-e2ed-485d-85a3-13f01c8e383b\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-79aeaa82-5216-4611-a183-c2a200b7034f\">\n<div style=\"position:absolute;width:118.51852%;height:100%;left:-9.25926%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=4000&amp;h=6000&amp;fit=max\" alt=\"Weather Reporting System using IoT\" srcSet=\"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=4000&amp;h=6000&amp;fit=max 4000w,https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=3200&amp;h=4800&amp;fit=max 3200w,https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=2400&amp;h=3600&amp;fit=max 2400w,https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=1600&amp;h=2400&amp;fit=max 1600w,https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=800&amp;h=1200&amp;fit=max 800w,https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=340&amp;h=510&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 53vh, 119vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.73786%;top:35.43689%;width:82.52427%;height:44.17476%;opacity:1\">\n<div id=\"anim-b88aedb0-1090-4fe2-a348-cb9bb35e2988\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-89961301-7f91-4548-ab10-dc6b5d455c49\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5882352941176471% 0.5882352941176471% 0.5882352941176471% 0.5882352941176471% \/ 0.7326007326007326% 0.7326007326007326% 0.7326007326007326% 0.7326007326007326%\" id=\"el-71e82b17-746d-4d30-9fe6-72dfdfb24b08\">\n<h2 id=\"1-let-city-1-be-starting-point-and-ending-point-we-can-consider-any-point-as-a-starting-point-since-the-route-is-cyclic-2-generate-all-possible-permutations-of-cities-which-are-n-1\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6423529411764709% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">1. Let city 1 be starting point and ending point. We can consider any point as a starting point since the route is cyclic.&nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">2. Generate all possible permutations of cities which are (n-1)!.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-2715a4bc-e92e-4906-a841-7e86a36cdd6d\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:12.29773%;width:100%;height:10.03236%;opacity:1\">\n<div id=\"anim-8e9bf8bc-bdda-4059-a580-095f97f87b4f\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-abb314e8-f556-4aa3-9929-8a225a0b12f1\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.48543689320388345% 0.48543689320388345% 0.48543689320388345% 0.48543689320388345% \/ 3.225806451612903% 3.225806451612903% 3.225806451612903% 3.225806451612903%;background-clip:content-box;background-color:#c4c4c4\" id=\"el-42f28b36-9248-47d3-90d2-bd7d8cb5f7ea\">\n<h1 id=\"simple-approach\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.213592233009709% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.647249em;line-height:0.9;text-align:center;padding:0.9708737864077669% 1.9417475728155338%;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Simple Approach<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"277173cc-5715-49f8-a52a-cc1d7614dffc\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-e578d33e-8830-455d-a4c8-823ac9edaf5a\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-deb1dd07-c5d9-4cc6-8699-84bf5aefcbe8\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-a5443633-867b-4d51-bd34-87a978ec538b [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#f3f3f3\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-a5443633-867b-4d51-bd34-87a978ec538b\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-dc9776bd-a5e5-41cc-9160-89bf8e196164\">\n<div style=\"position:absolute;width:266.31253%;height:100%;left:-83.15627%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"group of people sitting beside rectangular wooden table with laptops\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.55)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.55)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.98058%;top:36.08414%;width:83.25243%;height:33.17152%;opacity:1\">\n<div id=\"anim-e578d33e-8830-455d-a4c8-823ac9edaf5a\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-deb1dd07-c5d9-4cc6-8699-84bf5aefcbe8\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5830903790087464% 0.5830903790087464% 0.5830903790087464% 0.5830903790087464% \/ 0.975609756097561% 0.975609756097561% 0.975609756097561% 0.975609756097561%\" id=\"el-10a12e2a-8a3d-47a0-bb92-294a0c6e9cff\">\n<h2 id=\"3-determine-cost-of-each-permutation-and-keep-track-of-minimum-cost-permutation-4-return-permutation-with-minimum-cost\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6367346938775513% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">3. Determine cost of each permutation and keep track of minimum cost permutation.&nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">4. Return permutation with minimum cost.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-272f6859-b105-49e3-ad7b-f45fd2aa76ca\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"bc60c57e-a103-4417-900c-bd0d04f53aef\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-0a2581ee-1f24-4c4b-8531-e9a544496dd5\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-39420d50-b660-4c2e-a1c0-572c9608579b\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-9c3ded6c-f3b7-473b-b082-f3dbae269e70 [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(25%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#262626\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-9c3ded6c-f3b7-473b-b082-f3dbae269e70\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-15fc455c-8aec-405d-9b72-81ecfc9f4aef\">\n<div style=\"position:absolute;width:118.51852%;height:100%;left:0%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=4000&amp;h=6000&amp;fit=max\" alt=\"media\/unsplash:7wLQNYKL3Rw\" srcSet=\"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=4000&amp;h=6000&amp;fit=max 4000w,https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=3200&amp;h=4800&amp;fit=max 3200w,https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=2400&amp;h=3600&amp;fit=max 2400w,https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=1600&amp;h=2400&amp;fit=max 1600w,https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=800&amp;h=1200&amp;fit=max 800w,https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=340&amp;h=510&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 53vh, 119vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:7.28155%;top:38.83495%;width:86.16505%;height:22.3301%;opacity:1\">\n<div id=\"anim-0a2581ee-1f24-4c4b-8531-e9a544496dd5\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-39420d50-b660-4c2e-a1c0-572c9608579b\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5633802816901409% 0.5633802816901409% 0.5633802816901409% 0.5633802816901409% \/ 1.4492753623188406% 1.4492753623188406% 1.4492753623188406% 1.4492753623188406%\" id=\"el-84ea2df9-ceff-472a-bac3-cf281b1ff14a\">\n<h2 id=\"time-complexity-onhere-n-is-number-of-cities-space-complexity-o1\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.615211267605634% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Time complexity: <\/span><span style=\"color: #fff\">O(N!)<\/span><br \/>\n<span style=\"color: #fff\">Here, N is number of cities.<\/span><\/p>\n<p><span style=\"font-weight: 700; color: #e06e04\">Space complexity:<\/span><span style=\"color: #fff\"> O(1)<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-d8513910-8a83-4deb-b566-2db31069c93c\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/cover-2.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"f8edc689-b3b9-402a-bbe2-412ff0f6f60f\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-a5f23aa9-dd95-4b77-80c9-1e68632c1d46 [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(25%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-ca9a7116-c503-44a1-914a-207318637301\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-60ba162b-a44b-4300-8526-e477f4792f00\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-c89fddee-611f-4e9e-9a88-59ec0af9d164\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-a422225f-7160-40f1-8ca2-0653c9cd2823\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#c0d9c0\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-a5f23aa9-dd95-4b77-80c9-1e68632c1d46\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-13922a8c-9d16-438b-bf06-93ebb7d22548\">\n<div style=\"position:absolute;width:118.57814%;height:100%;left:0%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=5304&amp;h=7952&amp;fit=max\" alt=\"man in pink button up shirt sitting beside woman in blue and black shirt\" srcSet=\"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=5304&amp;h=7952&amp;fit=max 5304w,https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=4243&amp;h=6361&amp;fit=max 4243w,https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=3182&amp;h=4771&amp;fit=max 3182w,https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=2121&amp;h=3180&amp;fit=max 2121w,https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=1060&amp;h=1589&amp;fit=max 1060w,https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&amp;ixlib=rb-1.2.1&amp;fm=jpg&amp;w=340&amp;h=510&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 53vh, 119vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:9.2233%;top:41.26214%;width:83.25243%;height:17.1521%;opacity:1\">\n<div id=\"anim-ca9a7116-c503-44a1-914a-207318637301\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-60ba162b-a44b-4300-8526-e477f4792f00\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5830903790087464% 0.5830903790087464% 0.5830903790087464% 0.5830903790087464% \/ 1.8867924528301887% 1.8867924528301887% 1.8867924528301887% 1.8867924528301887%\" id=\"el-c3b82f1b-f33e-4c30-8ccf-11baeb3dc8a6\">\n<h2 id=\"here-we-calculate-the-cost-function-cost-using-a-dynamic-approach-cost\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6367346938775513% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">Here, we calculate the cost function cost() using a dynamic approach Cost ().<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-3d6f8ba6-e85a-4bbf-8e50-e010c1a1d1d4\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:12.29773%;width:100%;height:10.03236%;opacity:1\">\n<div id=\"anim-c89fddee-611f-4e9e-9a88-59ec0af9d164\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-a422225f-7160-40f1-8ca2-0653c9cd2823\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.48543689320388345% 0.48543689320388345% 0.48543689320388345% 0.48543689320388345% \/ 3.225806451612903% 3.225806451612903% 3.225806451612903% 3.225806451612903%;background-clip:content-box;background-color:#c4c4c4\" id=\"el-1756133c-f9f4-440c-8d78-7c72854c7b60\">\n<h1 id=\"dynamic-approach\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.213592233009709% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.647249em;line-height:0.9;text-align:center;padding:0.9708737864077669% 1.9417475728155338%;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Dynamic Approach<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"e34fae79-d454-47c8-82af-a2c99f092a3d\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-a0cc36a5-e8ea-42a6-91de-7466c6337611 [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-ada71ff9-9870-40e5-885c-9a3697a45719\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-bab0aaed-c2ab-4abb-a76e-664d56ddfe2e\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#c0c0c0\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-a0cc36a5-e8ea-42a6-91de-7466c6337611\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-65218359-f7e7-4e25-9a06-6d3ad69d31c9\">\n<div style=\"position:absolute;width:259.49821%;height:100%;left:-79.74911%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6154&amp;h=4216&amp;fit=max\" alt=\"selective focus photography of people sits in front of table inside room\" srcSet=\"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6154&amp;h=4216&amp;fit=max 6154w,https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4923&amp;h=3373&amp;fit=max 4923w,https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3692&amp;h=2529&amp;fit=max 3692w,https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2461&amp;h=1686&amp;fit=max 2461w,https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1230&amp;h=843&amp;fit=max 1230w,https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=233&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 117vh, 260vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.25243%;top:41.26214%;width:91.74757%;height:11.65049%;opacity:1\">\n<div id=\"anim-ada71ff9-9870-40e5-885c-9a3697a45719\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-bab0aaed-c2ab-4abb-a76e-664d56ddfe2e\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5291005291005291% 0.5291005291005291% 0.5291005291005291% 0.5291005291005291% \/ 2.7777777777777777% 2.7777777777777777% 2.7777777777777777% 2.7777777777777777%\" id=\"el-93dfa69b-ddd5-4ff2-92e4-23389755a69b\">\n<h2 id=\"time-complexity-on22n\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.5777777777777781% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Time Complexity: <\/span><span style=\"color: #fff\">O(N^2*2^N)&nbsp;<\/span><\/p>\n<p><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-21dc4ad3-9c08-4d8c-981f-10bc9127864d\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"ce8709c0-7c6a-42a9-806e-786f79289b82\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-3afdbf0e-fd22-4971-b23e-2e476035b7bd\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-f0eaf7b8-63f3-450c-91d4-d93a98f48c03\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-8d048476-e6d9-4450-951f-52e400bff864\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-7fcb8170-235d-45f1-af82-ca0b29200584\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-8c3aa7c1-2652-4b59-a27e-2c38917b158d [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#f3f3f3\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-8c3aa7c1-2652-4b59-a27e-2c38917b158d\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-c81b0417-4d8e-476d-bb7e-1f6c1ee435af\">\n<div style=\"position:absolute;width:266.64199%;height:100%;left:-83.32099%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=5401&amp;h=3601&amp;fit=max\" alt=\"man in blue dress shirt sitting on black office rolling chair\" srcSet=\"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=5401&amp;h=3601&amp;fit=max 5401w,https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4320&amp;h=2880&amp;fit=max 4320w,https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3240&amp;h=2160&amp;fit=max 3240w,https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2160&amp;h=1440&amp;fit=max 2160w,https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1080&amp;h=720&amp;fit=max 1080w,https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.98058%;top:31.39159%;width:86.16505%;height:33.17152%;opacity:1\">\n<div id=\"anim-3afdbf0e-fd22-4971-b23e-2e476035b7bd\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-f0eaf7b8-63f3-450c-91d4-d93a98f48c03\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5633802816901409% 0.5633802816901409% 0.5633802816901409% 0.5633802816901409% \/ 0.975609756097561% 0.975609756097561% 0.975609756097561% 0.975609756097561%\" id=\"el-63addf81-f4d3-4ffa-a5d1-726dd6d42851\">\n<h2 id=\"1-create-two-primary-data-holders-list-containing-indices-of-cities-based-on-input-matrix-of-distance-array-containing-our-result\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.615211267605634% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">1. Create two primary data holders. &nbsp;<\/span><br \/>\n<span style=\"color: #fff\">&nbsp;&#8211; List containing indices of cities based on input matrix of distance.&nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">&nbsp;&#8211; Array containing our result<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-5c1b43c2-412f-480b-81a7-8b920cd18c72\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:12.29773%;width:100%;height:10.03236%;opacity:1\">\n<div id=\"anim-8d048476-e6d9-4450-951f-52e400bff864\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-7fcb8170-235d-45f1-af82-ca0b29200584\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.48543689320388345% 0.48543689320388345% 0.48543689320388345% 0.48543689320388345% \/ 3.225806451612903% 3.225806451612903% 3.225806451612903% 3.225806451612903%;background-clip:content-box;background-color:#c4c4c4\" id=\"el-0064a597-73ff-43ca-8ceb-2a0b3e6b88ff\">\n<h1 id=\"greedy-approach\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.213592233009709% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.647249em;line-height:0.9;text-align:center;padding:0.9708737864077669% 1.9417475728155338%;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Greedy Approach<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"49d1a0e5-24f3-4480-8601-91150e91946b\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-764ee145-b63d-4790-8a4d-68021f672ddc\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-4efa1b54-2734-4e99-9211-de3e46276716\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-84a6e308-2ffe-466c-adfd-659e63629b3d [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#f3d9a6\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-84a6e308-2ffe-466c-adfd-659e63629b3d\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-c81b0417-4d8e-476d-bb7e-1f6c1ee435af\">\n<div style=\"position:absolute;width:266.31253%;height:100%;left:-83.15627%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"three women beside table looking at MacBook\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.25243%;top:38.51133%;width:83.73786%;height:27.99353%;opacity:1\">\n<div id=\"anim-764ee145-b63d-4790-8a4d-68021f672ddc\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-4efa1b54-2734-4e99-9211-de3e46276716\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5797101449275363% 0.5797101449275363% 0.5797101449275363% 0.5797101449275363% \/ 1.1560693641618496% 1.1560693641618496% 1.1560693641618496% 1.1560693641618496%\" id=\"el-fe62ae10-dbd8-464d-9605-08595d88739d\">\n<h2 id=\"2-traverse-the-given-adjacency-matrix-tsp-for-all-the-cities-and-update-the-cost-if-the-cost-of-reaching-any-city-is-less-than-the-current-cost\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6330434782608698% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">2. Traverse the given adjacency matrix tsp[][] for all the cities, and update the cost if the cost of reaching any city is less than the current cost.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-eef4f4e5-1532-4801-893f-320498aeebea\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"ac210c64-2f3a-4766-a126-ee64cf4d58c8\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-78dc4a2c-4798-4bd3-a4e1-b56eb8af8977\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-11c8baf4-68a5-4a8e-b61c-c601729b7489\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-70a0df90-4a74-4a76-ad31-86a36b7541ad [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#d9d9d9\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-70a0df90-4a74-4a76-ad31-86a36b7541ad\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-16169971-a896-4708-b356-8235d750cbac\">\n<div style=\"position:absolute;width:266.66667%;height:100%;left:-83.33334%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3600&amp;h=2400&amp;fit=max\" alt=\"woman placing sticky notes on wall\" srcSet=\"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3600&amp;h=2400&amp;fit=max 3600w,https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2880&amp;h=1920&amp;fit=max 2880w,https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2160&amp;h=1440&amp;fit=max 2160w,https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1440&amp;h=960&amp;fit=max 1440w,https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=720&amp;h=480&amp;fit=max 720w,https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:8.25243%;top:38.51133%;width:83.73786%;height:17.1521%;opacity:1\">\n<div id=\"anim-78dc4a2c-4798-4bd3-a4e1-b56eb8af8977\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-11c8baf4-68a5-4a8e-b61c-c601729b7489\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5797101449275363% 0.5797101449275363% 0.5797101449275363% 0.5797101449275363% \/ 1.8867924528301887% 1.8867924528301887% 1.8867924528301887% 1.8867924528301887%\" id=\"el-9efac827-d099-4bc2-a4f0-1f948d9c1cf3\">\n<h2 id=\"3-calculate-the-minimum-path-cycle-using-above-step-and-return-their-minimum-cost\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6330434782608698% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">3. Calculate the minimum path cycle using above step and return their minimum cost.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-c976d164-4802-48d2-9abf-7ea67a33d85d\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"0ef1df4c-e55c-4bc3-b1f8-e2dde6ce0e44\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-a99b1193-69a5-4c50-92fe-e6c1d7b913c6\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-fb4609a4-3b3f-416b-a011-94a5033b0a32\",\"keyframes\":{\"transform\":[\"scale(0.3333333333333333)\",\"scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-d9fe5efa-8a94-4272-b7fe-c6503e5faf93 [data-leaf-element=\\\"true\\\"]\",\"keyframes\":{\"transform\":[\"translate(0%, 0%) scale(1.5)\",\"translate(0%, 0%) scale(1)\"]},\"delay\":0,\"duration\":2000,\"easing\":\"cubic-bezier(.3,0,.55,1)\",\"fill\":\"forwards\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#d9f3f3\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div id=\"anim-d9fe5efa-8a94-4272-b7fe-c6503e5faf93\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-c81b0417-4d8e-476d-bb7e-1f6c1ee435af\">\n<div style=\"position:absolute;width:266.31253%;height:100%;left:-83.15627%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"two women sitting on gray sofa with laptops\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=227&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 120vh, 267vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-b134620b-de67-4ae9-8c5e-7dd6d37a1cc9\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:8.25243%;top:41.26214%;width:91.74757%;height:17.1521%;opacity:1\">\n<div id=\"anim-a99b1193-69a5-4c50-92fe-e6c1d7b913c6\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-fb4609a4-3b3f-416b-a011-94a5033b0a32\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:scale(0.3333333333333333)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0;border-radius:0.5291005291005291% 0.5291005291005291% 0.5291005291005291% 0.5291005291005291% \/ 1.8867924528301887% 1.8867924528301887% 1.8867924528301887% 1.8867924528301887%\" id=\"el-964edd49-8422-4ab2-abf3-b53492e50534\">\n<h2 id=\"time-complexity-on2logn-space-complexity-on\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.5777777777777781% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.453074em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #e06e04\">Time complexity: <\/span><span style=\"color: #fff\">O(N^2*logN)&nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 700; color: #e06e04\">Space complexity: <\/span><span style=\"color: #fff\">O(N)<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">Read More<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"b2cd7624-c3ec-4a7d-9867-d7d4dc8f0933\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-59837282-c444-44f0-9eb7-45235ec00f0a\",\"keyframes\":{\"opacity\":[0,1]},\"delay\":0,\"duration\":1000,\"easing\":\"cubic-bezier(0.2, 0.6, 0.0, 1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-8ec47475-55dd-4964-8c19-f17e83964969\",\"keyframes\":{\"transform\":[\"translate3d(0px, 168.38573%, 0)\",\"translate3d(0px, 0px, 0)\"]},\"delay\":0,\"duration\":1000,\"easing\":\"cubic-bezier(0.2, 0.6, 0.0, 1)\",\"fill\":\"both\"}]<\/script><\/amp-story-animation><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\" style=\"background-color:#f3f3f3\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:0;top:-9.25926%;width:100%;height:118.51852%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-ae3f6c5c-5c72-4ba8-b6bc-e71174f9ed50\">\n<div style=\"position:absolute;width:142.20546%;height:100%;left:-21.10273%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3394&amp;h=4243&amp;fit=max\" alt=\"media\/unsplash:QUHuwyNgSA0\" srcSet=\"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3394&amp;h=4243&amp;fit=max 3394w,https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2715&amp;h=3394&amp;fit=max 2715w,https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2036&amp;h=2545&amp;fit=max 2036w,https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1357&amp;h=1696&amp;fit=max 1357w,https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=678&amp;h=848&amp;fit=max 678w,https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=425&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 64vh, 142vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.5)\"><\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-grid-layer template=\"vertical\" aspect-ratio=\"412:618\" class=\"grid-layer\"><\/p>\n<div class=\"page-fullbleed-area\">\n<div class=\"page-safe-area\">\n<div style=\"position:absolute;pointer-events:none;left:11.65049%;top:37.05502%;width:63.83495%;height:42.88026%;opacity:1\">\n<div id=\"anim-59837282-c444-44f0-9eb7-45235ec00f0a\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:0;--initial-transform:none\">\n<div id=\"anim-8ec47475-55dd-4964-8c19-f17e83964969\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:translate3d(0px, 168.38573%, 0)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" id=\"el-021e0541-35be-4946-80af-40b0a2d780a0\">\n<h2 id=\"how-to-implement-these-solutions-in-different-languages\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.4383243227186315% 0;font-family:&quot;Anton&quot;,sans-serif;font-size:0.679612em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #faf4ea\">How to implement these solutions in different languages?<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:-6.31068%;width:43.68932%;height:9.70874%;opacity:1\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" class=\"mask\" id=\"el-d8431b7e-175f-447d-8b3d-3fc64bb112fd\">\n<div style=\"position:absolute;width:100.28251%;height:100%;left:-0.14125%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png\" alt=\"InterviewBit-White-2\" srcSet=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png 2130w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png 2048w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png 1536w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png 1024w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png 768w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png 300w,https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png 150w\" sizes=\"(min-width: 1024px) 20vh, 44vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><amp-story-page-outlink layout=\"nodisplay\" cta-image=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&amp;utm_medium=travelling-salesman-problem&amp;utm_campaign=webstories\" rel=\"\">SWIPE UP<\/a><\/amp-story-page-outlink><\/amp-story-page><\/amp-story><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"With this web story, you will gain a thorough understanding of the Travelling Salesman problem and its possible solution.\n","protected":false},"author":21,"featured_media":14564,"template":"","meta":{"_daextam_enable_autolinks":"","web_stories_products":[],"web_stories_publisher_logo":1082,"web_stories_poster":[]},"web_story_category":[1944],"web_story_tag":[2021],"amp_enabled":false,"story_data":{"version":43,"pages":[{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"22ae990b-24ec-4f61-9792-67850d36d3d5","basedOn":"11ef0ff2-7ece-45b6-b2ff-64736e54ce84","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#c0c0c0","blurHash":"LOE2@8t7%g-;~WoftS%MWUWAozoz","type":"image","mimeType":"image\/jpeg","creationDate":"2018-03-22T16:56:54Z","src":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=5304&h=7952&fit=max","width":5304,"height":7952,"id":"media\/unsplash:MChSQHxGZrQ","alt":"men sitting in front of their laptop computer","sizes":{"full":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=5304&h=7952&fit=max","mimeType":"image\/jpeg","width":5304,"height":7952},"large":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=4243&h=6361&fit=max","mimeType":"image\/jpeg","width":4243,"height":6361},"3182_4771":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=3182&h=4771&fit=max","mimeType":"image\/jpeg","width":3182,"height":4771},"2121_3180":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=2121&h=3180&fit=max","mimeType":"image\/jpeg","width":2121,"height":3180},"1060_1589":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=1060&h=1589&fit=max","mimeType":"image\/jpeg","width":1060,"height":1589},"web_stories_thumbnail":{"file":"media\/unsplash:MChSQHxGZrQ","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737711867-e3b97375f902?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=340&h=510&fit=max","mimeType":"image\/jpeg","width":340,"height":510}},"attribution":{"author":{"displayName":"Annie Spratt","url":"https:\/\/unsplash.com\/@anniespratt?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tr5BHUbdr0mvjz3wowBWY3KP13dOC%2BQH2LiFdZtXoVyYFETlCX4x2BuqV6LTha5uJOgB1IlVY0WUHQQKUUiE0j72\/HIdtxT28%2BY6fvUaprTDWs2K9vTPPrXfvt\/%2Bf8DFInZjYGnKn6FFlAa2fmsG1Ydv3chwiS9\/4T7f06ljt2N17keEw28QdGPn3exEBwIeB21ikvZsxbvlSZB4x\/YLL7VUAec00%2BZnLdAfnLQEpn1lDQPgO4i5dNqdIjqAcE3J4nM"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"bcc685a3-50e0-4220-aa2d-37d04255b533","id":"84a9fe46-f171-471f-bb69-fb55fff093d6"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Merriweather","fallbacks":["serif"],"weights":[300,400,700,900],"styles":["italic","regular"],"variants":[[0,300],[1,300],[0,400],[1,400],[0,700],[1,700],[0,900],[1,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":984,"des":-273,"tAsc":984,"tDes":-273,"tLGap":0,"wAsc":1065,"wDes":273,"xH":555,"capH":743,"yMin":-272,"yMax":1055,"hAsc":984,"hDes":-273,"lGap":0}},"fontSize":50,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.19,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":0,"vertical":0},"type":"text","content":"<span style=\"font-weight: 700; color: #fff\">Travelling Salesman Problem<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":34,"y":247,"width":342,"height":182,"scale":100,"focalX":50,"focalY":50,"id":"5a03f828-20ca-4b52-b11f-7a23ec19dee9"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":false,"scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#74bcec","type":"image","mimeType":"image\/gif","creationDate":"2020-04-09T12:51:28Z","src":"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAi\/fl%C3%A8che-arrow.gif","width":498,"height":133,"id":"media\/tenor:8217629219290116052","alt":"Fl\u00e8che Arrow Sticker","sizes":{"full":{"file":"media\/tenor:8217629219290116052","sourceUrl":"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAi\/fl%C3%A8che-arrow.gif","mimeType":"image\/gif","width":498,"height":133},"large":{"file":"media\/tenor:8217629219290116052","sourceUrl":"https:\/\/c.tenor.com\/cgriPG-ob9QAAAAq\/tenor.gif","mimeType":"image\/gif","width":498,"height":133},"200_53":{"file":"media\/tenor:8217629219290116052","sourceUrl":"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAj\/fl%C3%A8che-arrow.gif","mimeType":"image\/gif","width":200,"height":53},"web_stories_thumbnail":{"file":"media\/tenor:8217629219290116052","sourceUrl":"https:\/\/media.tenor.com\/cgriPG-ob9QAAAAk\/fl%C3%A8che-arrow.gif","mimeType":"image\/gif","width":90,"height":24}},"attribution":{"author":{"displayName":"simkone","url":"https:\/\/tenor.com\/users\/simkone"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tqdh\/dp%2BkeorDPjx8rcHNGXRhl5GjmLVCkfZ3b1B0r1IDYnKLwoHuiL\/7gztUZ4Q3woWyZxNVQltIJfaYh\/q0q0Dg%3D%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"type":"image","x":41,"y":570,"width":330,"height":82,"mask":{"type":"rectangle","showInLibrary":true,"name":"Rectangle","path":"M 0,0 1,0 1,1 0,1 0,0 Z","ratio":1,"supportsBorder":true},"id":"6f338729-862c-4acf-9ed6-e37e14299c8a"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Roboto","fallbacks":["sans-serif"],"weights":[100,300,400,500,700,900],"styles":["italic","regular"],"variants":[[0,100],[1,100],[0,300],[1,300],[0,400],[1,400],[0,500],[1,500],[0,700],[1,700],[0,900],[1,900]],"service":"fonts.google.com","metrics":{"upm":2048,"asc":1900,"des":-500,"tAsc":1536,"tDes":-512,"tLGap":102,"wAsc":1946,"wDes":512,"xH":1082,"capH":1456,"yMin":-555,"yMax":2163,"hAsc":1900,"hDes":-500,"lGap":0}},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":0,"vertical":0},"type":"text","content":"<span style=\"color: #e06e04\">A Quick Overview<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":36,"y":444,"width":329,"height":35,"scale":100,"focalX":50,"focalY":50,"id":"5b15132f-f6e9-4720-9e5a-c23a5493346d"}],"animations":[],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"2ba48566-4303-4648-be14-d8b890969253","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"13c50b8d-b251-4ffe-b15f-e41541a64185","basedOn":"11ef0ff2-7ece-45b6-b2ff-64736e54ce84"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"783eb30d-5544-49d0-ba8f-e169faf92c1a","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3d9a6","blurHash":"L#LM^e$yozIo~UROWYRjofWBWEkC","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:56:03Z","src":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:NDoVgcS_lZM","alt":"three women beside table looking at MacBook","sizes":{"full":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=4812&h=3212&fit=max","mimeType":"image\/jpeg","width":4812,"height":3212},"3609_2409":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=3609&h=2409&fit=max","mimeType":"image\/jpeg","width":3609,"height":2409},"2406_1606":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=2406&h=1606&fit=max","mimeType":"image\/jpeg","width":2406,"height":1606},"1203_803":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=1203&h=803&fit=max","mimeType":"image\/jpeg","width":1203,"height":803},"web_stories_thumbnail":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyN3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI4Ng&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"Christina @ wocintechchat.com","url":"https:\/\/unsplash.com\/@wocintechchat?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tpgGNS62OL5PlbdjdHz\/5fnT635jZyAl1bDLv69kLU7OwpJ4OF8uXT4srfsYtl7ATF7HeyIPt2\/I%2BZEUDOIjMI6bSm8qQ3YE7UH1odCanuI8%2BHwwQxWgcbHvLHe4PPLRgB5AFyklQNf\/JL3zcweVkxh5r4OCn9xeijQCbALdYxng817tI0st8XFhv%2Bc%2BcMnwcf8NhwTBo61ATiMN4H\/YkHePVQ6b2Kgt95t9Makl\/mu214dP\/V0O8MaCu\/toQdGpv3V"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":45,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":0.9,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Problem Statement<\/span>","fontWeight":700,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":38,"y":190,"width":350,"height":61,"scale":100,"focalX":50,"focalY":50,"id":"7cd230c0-4238-4ec5-adce-927aef7b27e4","marginOffset":-33.45600000000001,"basedOn":"14bb0c1d-b114-4235-8cfa-a9650723dd19","groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":360,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">Given a set of cities and distance between every pair of cities as an adjacency matrix, the problem is to find shortest route that visits all cities exactly once and returns to starting point.<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":337,"height":205,"scale":100,"focalX":50,"focalY":50,"basedOn":"9b73ef3b-3831-463a-995d-86e6b3244924","id":"7bb8f5a3-dbd4-41bc-9727-7be2fd18d627","x":41,"y":279,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"fc6c6249-6fbf-4dbc-a29e-1a11b2b9d388"}],"animations":[{"id":"0b028b83-7635-4a07-9ab3-2c88bd973be3","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["7cd230c0-4238-4ec5-adce-927aef7b27e4"]},{"id":"b54acda9-6d33-4bf3-adf3-81d52bd5d0a9","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["7bb8f5a3-dbd4-41bc-9727-7be2fd18d627"]},{"id":"bb01d3af-8a41-44e5-9d21-b2fab9e9e819","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["783eb30d-5544-49d0-ba8f-e169faf92c1a"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"47ddb9f2-270d-4b0d-993f-122d8b97f3fb","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"f3a5f63f-1458-48b0-b7b5-9f254acd553f","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"79aeaa82-5216-4611-a183-c2a200b7034f","basedOn":"3fb7a607-01df-4a01-82d2-00cf755a3e1c","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#262626","blurHash":"LeF~mtD%IUt8~qayM{t7kBt8j?Rj","type":"image","mimeType":"image\/jpeg","creationDate":"2021-02-09T23:42:43Z","src":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=4000&h=6000&fit=max","width":4000,"height":6000,"id":"media\/unsplash:2w2NcgP3XNs","alt":"media\/unsplash:2w2NcgP3XNs","sizes":{"full":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=4000&h=6000&fit=max","mimeType":"image\/jpeg","width":4000,"height":6000},"large":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=3200&h=4800&fit=max","mimeType":"image\/jpeg","width":3200,"height":4800},"2400_3600":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=2400&h=3600&fit=max","mimeType":"image\/jpeg","width":2400,"height":3600},"1600_2400":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=1600&h=2400&fit=max","mimeType":"image\/jpeg","width":1600,"height":2400},"800_1200":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=800&h=1200&fit=max","mimeType":"image\/jpeg","width":800,"height":1200},"web_stories_thumbnail":{"file":"media\/unsplash:2w2NcgP3XNs","sourceUrl":"https:\/\/images.unsplash.com\/photo-1612914033131-2fbd331a3806?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8ZGF0YSUyMGFuYWx5dGljc3xlbnwwfHx8fDE2NjM3NTgzMDc&ixlib=rb-1.2.1&fm=jpg&w=340&h=510&fit=max","mimeType":"image\/jpeg","width":340,"height":510}},"attribution":{"author":{"displayName":"Mar\u00edlia Castelli","url":"https:\/\/unsplash.com\/@liacastelli?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tptocw8ALDZNI1EvoZXoFcoQUER8QQUsd\/WW8GWIUmddhvBpjgAetIP67gEiigGe9AbVMnHsxsTbKj%2Bm%2Be3m5YWciW4qKUhqP%2BBhKLUYH5ozbIHPmqZ85aZz44jIPv46cgPdh9%2BUsXT8bCgfMdsEmH%2BTe\/aVVcmm2oJY72gAU5IkjJK0yJV9lRJoZm\/Q9KP6AJ2Zko79rkK%2BaxqAZI9osgbh5lj8gpwgj6ykOUpYS%2B6AIWKPNy7rFDICAc%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}},"alt":"Weather Reporting System using IoT"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">1. Let city 1 be starting point and ending point. We can consider any point as a starting point since the route is cyclic.&nbsp;<\/span>\n\n<span style=\"color: #fff\">2. Generate all possible permutations of cities which are (n-1)!.<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":340,"height":273,"scale":100,"focalX":50,"focalY":50,"basedOn":"a0259225-7078-482e-8257-f773446493c0","id":"71e82b17-746d-4d30-9fe6-72dfdfb24b08","x":36,"y":219,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"2715a4bc-e92e-4906-a841-7e86a36cdd6d"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":40,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Simple Approach<\/span>","fontWeight":700,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":76,"width":412,"height":62,"scale":100,"focalX":50,"focalY":50,"marginOffset":-33.45600000000001,"basedOn":"0064a597-73ff-43ca-8ceb-2a0b3e6b88ff","groupId":null,"id":"42f28b36-9248-47d3-90d2-bd7d8cb5f7ea"}],"animations":[{"id":"1b0ed17a-b718-421b-a005-8c142f9224e4","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["71e82b17-746d-4d30-9fe6-72dfdfb24b08"]},{"id":"ce3a54f9-232b-4704-99ce-09ee91b0656f","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["79aeaa82-5216-4611-a183-c2a200b7034f"]},{"targets":["42f28b36-9248-47d3-90d2-bd7d8cb5f7ea"],"id":"35df24ef-6ea1-4fc9-be4a-ab8bd8c76b6e","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"becbb31f-aa34-4058-b76e-6f59d68a9dae","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"8711ec8c-c179-493b-883f-6b3b31f32223","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"dc9776bd-a5e5-41cc-9160-89bf8e196164","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3f3f3","blurHash":"LhK^{X%hIot7_4R,xFoLVrRjR+Rj","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:10:23Z","src":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:faEfWCdOKIg","alt":"group of people sitting beside rectangular wooden table with laptops","sizes":{"full":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=4812&h=3212&fit=max","mimeType":"image\/jpeg","width":4812,"height":3212},"3609_2409":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=3609&h=2409&fit=max","mimeType":"image\/jpeg","width":3609,"height":2409},"2406_1606":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=2406&h=1606&fit=max","mimeType":"image\/jpeg","width":2406,"height":1606},"1203_803":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=1203&h=803&fit=max","mimeType":"image\/jpeg","width":1203,"height":803},"web_stories_thumbnail":{"file":"media\/unsplash:faEfWCdOKIg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574572-cb89e39749b4?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMHx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjYyMzI3MA&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"Christina @ wocintechchat.com","url":"https:\/\/unsplash.com\/@wocintechchat?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tq4Qzvi8HCFK6g0Q95HeFlxGhAUdG10kdfva30t9FYR1kMja2\/kKj2LqJdlSziskrlU7jrDiPbPaBDej%2BqRhfhLvWlYECPpbhJrOc3ssAuqRLuO6U%2B8eSSeAjqRiS0Uqh2\/LC3m1Nk8%2BVnzK3x3GdOnwpk\/1J%2BYIrkBWK\/bEhHW8N4GfKKrChMPtz3dtKO4ocbzjAeAKDf9U1\/wb1ZItuA%2BEXSSIea2o8e6w3aRVT7O1v9kqMaZHHgwgd9UhnOvazsX"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.55}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">3. Determine cost of each permutation and keep track of minimum cost permutation.&nbsp;<\/span>\n\n<span style=\"color: #fff\">4. Return permutation with minimum cost.<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":343,"height":205,"scale":100,"focalX":50,"focalY":50,"basedOn":"e5fd183e-3dbc-4fb1-958a-be04a3706844","id":"10a12e2a-8a3d-47a0-bb92-294a0c6e9cff","x":37,"y":223,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"272f6859-b105-49e3-ad7b-f45fd2aa76ca"}],"animations":[{"id":"d02c37e2-403d-4f25-a8cc-290236e457a1","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["10a12e2a-8a3d-47a0-bb92-294a0c6e9cff"]},{"id":"299b2e56-74b7-43be-ba38-0876691e8865","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["dc9776bd-a5e5-41cc-9160-89bf8e196164"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"277173cc-5715-49f8-a52a-cc1d7614dffc","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"733dd99c-1d86-40f7-b570-e94cdf5b3b1c","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":39,"y":11,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"15fc455c-8aec-405d-9b72-81ecfc9f4aef","basedOn":"30ac49d1-3343-4f30-a649-2806c4ad70e3","scale":100,"focalX":42.051630488779686,"focalY":50.06738994519435,"resource":{"baseColor":"#262626","blurHash":"LKBWJL0KWB%L~W9Gxut7xZIoxus:","type":"image","mimeType":"image\/jpeg","creationDate":"2021-09-14T12:57:24Z","src":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=4000&h=6000&fit=max","width":4000,"height":6000,"id":"media\/unsplash:7wLQNYKL3Rw","alt":"media\/unsplash:7wLQNYKL3Rw","sizes":{"full":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=4000&h=6000&fit=max","mimeType":"image\/jpeg","width":4000,"height":6000},"large":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=3200&h=4800&fit=max","mimeType":"image\/jpeg","width":3200,"height":4800},"2400_3600":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=2400&h=3600&fit=max","mimeType":"image\/jpeg","width":2400,"height":3600},"1600_2400":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=1600&h=2400&fit=max","mimeType":"image\/jpeg","width":1600,"height":2400},"800_1200":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=800&h=1200&fit=max","mimeType":"image\/jpeg","width":800,"height":1200},"web_stories_thumbnail":{"file":"media\/unsplash:7wLQNYKL3Rw","sourceUrl":"https:\/\/images.unsplash.com\/photo-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxkZXZvcHN8ZW58MHx8fHwxNjYyNjMwODM1&ixlib=rb-1.2.1&fm=jpg&w=340&h=510&fit=max","mimeType":"image\/jpeg","width":340,"height":510}},"attribution":{"author":{"displayName":"Mikhail Fesenko","url":"https:\/\/unsplash.com\/@proggga?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=ARX97wMpgUNkkLfVbWmGlkVtBjzh6DAcGYPwF53Br1Gs20EiryXmtpsOfBqrkjNKAfm7J6XrXH9scGsYxQP7Jv7F08BYj\/wNOx7HD3onQ6BVUnUzImq6EImbe%2B90LmxiIl3VC1e11CZ638zRXMyax\/\/tuwX%2BSRAyG\/P\/Ur3JbPsTsyIjRMjfueaaLHQED0GsFuRVbAKnsWYQKgwYnortw3GD1NZYOrcJvBg4XVg4RPM%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Time complexity: <\/span><span style=\"color: #fff\">O(N!)<\/span>\n<span style=\"color: #fff\">Here, N is number of cities.<\/span>\n\n<span style=\"font-weight: 700; color: #e06e04\">Space complexity:<\/span><span style=\"color: #fff\"> O(1)<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":355,"height":138,"scale":100,"focalX":50,"focalY":50,"basedOn":"8255e0b1-21c3-433d-8b5a-3d960f385949","id":"84ea2df9-ceff-472a-bac3-cf281b1ff14a","x":30,"y":240,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"d8513910-8a83-4deb-b566-2db31069c93c"}],"animations":[{"id":"ce9d43d9-54b3-44ca-9596-a05196311a3a","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["84ea2df9-ceff-472a-bac3-cf281b1ff14a"]},{"targets":["15fc455c-8aec-405d-9b72-81ecfc9f4aef"],"id":"ba21f1ff-ef64-4be6-83af-c402d9243ebc","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"bc60c57e-a103-4417-900c-bd0d04f53aef","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"998a0474-d77b-4894-aa13-0655967a53c6","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/cover-2.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"13922a8c-9d16-438b-bf06-93ebb7d22548","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":42.0556266524354,"focalY":50.06793410279936,"resource":{"baseColor":"#c0d9c0","blurHash":"LOGbxBXA0LM{9G%1ocR*GGRk?Hof","type":"image","mimeType":"image\/jpeg","creationDate":"2020-02-05T09:34:15Z","src":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=5304&h=7952&fit=max","width":5304,"height":7952,"id":"media\/unsplash:lLrZy195sIU","alt":"man in pink button up shirt sitting beside woman in blue and black shirt","sizes":{"full":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=5304&h=7952&fit=max","mimeType":"image\/jpeg","width":5304,"height":7952},"large":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=4243&h=6361&fit=max","mimeType":"image\/jpeg","width":4243,"height":6361},"3182_4771":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=3182&h=4771&fit=max","mimeType":"image\/jpeg","width":3182,"height":4771},"2121_3180":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=2121&h=3180&fit=max","mimeType":"image\/jpeg","width":2121,"height":3180},"1060_1589":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=1060&h=1589&fit=max","mimeType":"image\/jpeg","width":1060,"height":1589},"web_stories_thumbnail":{"file":"media\/unsplash:lLrZy195sIU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1580894899378-92e56886cd4d?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyMnx8c29mdHdhcmUlMjBlbmdpbmVlcnxlbnwwfHx8fDE2NjI2MzI5MzM&ixlib=rb-1.2.1&fm=jpg&w=340&h=510&fit=max","mimeType":"image\/jpeg","width":340,"height":510}},"attribution":{"author":{"displayName":"ThisisEngineering RAEng","url":"https:\/\/unsplash.com\/@thisisengineering?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=ARX97wMOJMXa0uo3y5kR4JNv3ZZXWjDaHwfxD8TLku8DPrYyDhMVQVCHhh3UN8UcxojHwg2kUCif7FoJgyPW7sMKEkG6GbukKjTvuFMoTGgmBpuitk1VWC1nvSzsSo9jpHXTpHvd3nR%2BNzAJDQH0jKb%2B\/cYk5ClBwdQxDGTCm\/v6knvpf96HnyWw\/xN\/p44l11kNvdRHIA1dYFng9DIv20x6ypAhqFkSicP94UdOWIgYPJKWXEJxTdQeTDjdtYUWrBGT"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">Here, we calculate the cost function cost() using a dynamic approach Cost ().<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":343,"height":106,"scale":100,"focalX":50,"focalY":50,"basedOn":"8255e0b1-21c3-433d-8b5a-3d960f385949","id":"c3b82f1b-f33e-4c30-8ccf-11baeb3dc8a6","x":38,"y":255,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"3d6f8ba6-e85a-4bbf-8e50-e010c1a1d1d4"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":40,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Dynamic Approach<\/span>","fontWeight":700,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":76,"width":412,"height":62,"scale":100,"focalX":50,"focalY":50,"marginOffset":-33.45600000000001,"basedOn":"0064a597-73ff-43ca-8ceb-2a0b3e6b88ff","groupId":null,"id":"1756133c-f9f4-440c-8d78-7c72854c7b60"}],"animations":[{"targets":["13922a8c-9d16-438b-bf06-93ebb7d22548"],"id":"3a976783-20e2-4e32-ab73-06bf4198f9a8","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0},{"id":"09d769b1-5688-4627-913c-754d3c10428b","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["c3b82f1b-f33e-4c30-8ccf-11baeb3dc8a6"]},{"targets":["1756133c-f9f4-440c-8d78-7c72854c7b60"],"id":"ff8a4cfd-e269-4efd-833a-1e3822e46b81","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"f8edc689-b3b9-402a-bbe2-412ff0f6f60f","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"2a49e5fe-7400-41ee-bdd0-0620e4c26af0","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":226,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"65218359-f7e7-4e25-9a06-6d3ad69d31c9","basedOn":"2a49e5fe-7400-41ee-bdd0-0620e4c26af0","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#c0c0c0","blurHash":"LRDl$kM{NG%N~pM{tR%gx]ax%Mof","type":"image","mimeType":"image\/jpeg","creationDate":"2018-03-22T16:58:42Z","src":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=6154&h=4216&fit=max","width":6154,"height":4216,"id":"media\/unsplash:sggw4-qDD54","alt":"selective focus photography of people sits in front of table inside room","sizes":{"full":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=6154&h=4216&fit=max","mimeType":"image\/jpeg","width":6154,"height":4216},"large":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=4923&h=3373&fit=max","mimeType":"image\/jpeg","width":4923,"height":3373},"3692_2529":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=3692&h=2529&fit=max","mimeType":"image\/jpeg","width":3692,"height":2529},"2461_1686":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=2461&h=1686&fit=max","mimeType":"image\/jpeg","width":2461,"height":1686},"1230_843":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=1230&h=843&fit=max","mimeType":"image\/jpeg","width":1230,"height":843},"web_stories_thumbnail":{"file":"media\/unsplash:sggw4-qDD54","sourceUrl":"https:\/\/images.unsplash.com\/photo-1521737852567-6949f3f9f2b5?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyOXx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY4Njg5NDky&ixlib=rb-4.0.3&fm=jpg&w=340&h=233&fit=max","mimeType":"image\/jpeg","width":340,"height":233}},"attribution":{"author":{"displayName":"Annie Spratt","url":"https:\/\/unsplash.com\/@anniespratt?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCF5SqLCWC8bu2asDqpVEpyTgyyGlx2cUjGO%2BhsM0XfnQaGRIc9Tg3R\/GH5ZR2UsDIQl%2B%2B1JJO3Vok\/FM9bNBcWAVHMXaHaouk\/k4cTYHeT\/nSNSFhLMrAFIfisLQhZaQhwLM\/BoJe2cAdompGWDzFyOSHHtf6I0Y7piKXOPMsTGA4lnHhVbkrKdYBOcITeboMiYYGAZi3UUevJVsxyDe4\/vf\/pyK%2BHAb8GBK9TcDaEks2aNyziw1Z96Lv%2B3K58EOA%3D%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Time Complexity: <\/span><span style=\"color: #fff\">O(N^2*2^N)&nbsp;<\/span>\n","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":378,"height":72,"scale":100,"focalX":50,"focalY":50,"basedOn":"28553d51-2298-409b-8af8-fb0c3abb5f0c","id":"93dfa69b-ddd5-4ff2-92e4-23389755a69b","x":34,"y":255,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"a5139dc6-af4d-488f-ac63-ee5c7f2eb31f","id":"21dc4ad3-9c08-4d8c-981f-10bc9127864d"}],"animations":[{"id":"a14bdd14-ac41-4df5-acfe-3e12a3766995","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["65218359-f7e7-4e25-9a06-6d3ad69d31c9"]},{"id":"5f58bc1e-9429-47f7-925b-e5624cf96a92","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["93dfa69b-ddd5-4ff2-92e4-23389755a69b"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"e34fae79-d454-47c8-82af-a2c99f092a3d","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"c81b0417-4d8e-476d-bb7e-1f6c1ee435af","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"c81b0417-4d8e-476d-bb7e-1f6c1ee435af","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3f3f3","blurHash":"LZMtgj%g?bRi~qIUIUxutQ-;jYoz","type":"image","mimeType":"image\/jpeg","creationDate":"2020-02-07T15:47:11Z","src":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=5401&h=3601&fit=max","width":5401,"height":3601,"id":"media\/unsplash:6DSItOWspGY","alt":"man in blue dress shirt sitting on black office rolling chair","sizes":{"full":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=5401&h=3601&fit=max","mimeType":"image\/jpeg","width":5401,"height":3601},"large":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=4320&h=2880&fit=max","mimeType":"image\/jpeg","width":4320,"height":2880},"3240_2160":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=3240&h=2160&fit=max","mimeType":"image\/jpeg","width":3240,"height":2160},"2160_1440":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=2160&h=1440&fit=max","mimeType":"image\/jpeg","width":2160,"height":1440},"1080_720":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=1080&h=720&fit=max","mimeType":"image\/jpeg","width":1080,"height":720},"web_stories_thumbnail":{"file":"media\/unsplash:6DSItOWspGY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1581090123456-6405208b0264?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw1OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyNzgy&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"ThisisEngineering RAEng","url":"https:\/\/unsplash.com\/@thisisengineering?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCF27s0nhCrYhvBKG5MDjpBtqvX3saZ5iFkh9\/b4pdtWYFpNvBTBz5pkefozms%2BqVsomV2HVKhxUf15dG5VRi%2B4mKKGoNjA0B5VAYlyCQ7av0JVouxaJkffnBFT9Q%2BCfux7%2BlTtRS1kZv17kTWw\/CrQ9Kyx12GWk2PChDvhl66rLddCpNRIGv7zAMQ02HIEFtZ6\/vvetiyWRsqqt6vM7urQbGNQVGHvu92EiJAvAMhh9AtMQb9ewMIuBxXkCf3wIpA%3D%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">1. Create two primary data holders. &nbsp;<\/span>\n<span style=\"color: #fff\">&nbsp;- List containing indices of cities based on input matrix of distance.&nbsp;<\/span>\n\n<span style=\"color: #fff\">&nbsp;- Array containing our result<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":355,"height":205,"scale":100,"focalX":50,"focalY":50,"basedOn":"93dfa69b-ddd5-4ff2-92e4-23389755a69b","id":"63addf81-f4d3-4ffa-a5d1-726dd6d42851","x":37,"y":194,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"21dc4ad3-9c08-4d8c-981f-10bc9127864d","id":"5c1b43c2-412f-480b-81a7-8b920cd18c72"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":40,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Greedy Approach<\/span>","fontWeight":700,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":76,"width":412,"height":62,"scale":100,"focalX":50,"focalY":50,"marginOffset":-33.45600000000001,"basedOn":"7c269567-2aee-4282-beab-aef4b9ea0cb1","groupId":null,"id":"0064a597-73ff-43ca-8ceb-2a0b3e6b88ff"}],"animations":[{"id":"69e5412e-7f89-4be7-97f0-26132fd6ccbc","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["63addf81-f4d3-4ffa-a5d1-726dd6d42851"]},{"targets":["0064a597-73ff-43ca-8ceb-2a0b3e6b88ff"],"id":"16a6c0c6-3137-4247-982b-db5badcda0da","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0},{"id":"ed7c95c8-06dc-4bdb-be4e-0fa2acf72cf2","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["c81b0417-4d8e-476d-bb7e-1f6c1ee435af"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"ce8709c0-7c6a-42a9-806e-786f79289b82","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"0accb28b-cfef-4904-80e2-1de07edcd853","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"c81b0417-4d8e-476d-bb7e-1f6c1ee435af","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3d9a6","blurHash":"L#LM^e$yozIo~UROWYRjofWBWEkC","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:56:03Z","src":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:NDoVgcS_lZM","alt":"three women beside table looking at MacBook","sizes":{"full":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=4812&h=3212&fit=max","mimeType":"image\/jpeg","width":4812,"height":3212},"3609_2409":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=3609&h=2409&fit=max","mimeType":"image\/jpeg","width":3609,"height":2409},"2406_1606":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=2406&h=1606&fit=max","mimeType":"image\/jpeg","width":2406,"height":1606},"1203_803":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=1203&h=803&fit=max","mimeType":"image\/jpeg","width":1203,"height":803},"web_stories_thumbnail":{"file":"media\/unsplash:NDoVgcS_lZM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573167243872-43c6433b9d40?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw5MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5MjEyODE2&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"Christina @ wocintechchat.com","url":"https:\/\/unsplash.com\/@wocintechchat?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCGned8nQRmxCyMPJqSCzZALpDunsdcLqfsBRxpRWWUCo1zq9d7ClOEj4V5XMfk8AcS3LCuc2N1wzBTckLCgOwqtLTKu6Cv5KFVpGFppt43IXfSVkSg3HY29hAlkIjJqgNp%2BjMVL18NyIGONZO8R3USOz8WkKTetdnh%2BCOvvo1oKaPjzOFaw1FUjs8k6OfZzMYTQhR8CsrWSVMeDfbf%2BabPZrFQPmasGLwy2p62doT4HUg67u0n1brmWKHOWXc%2B63w%3D%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">2. Traverse the given adjacency matrix tsp[][] for all the cities, and update the cost if the cost of reaching any city is less than the current cost.<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":345,"height":173,"scale":100,"focalX":50,"focalY":50,"basedOn":"63addf81-f4d3-4ffa-a5d1-726dd6d42851","id":"fe62ae10-dbd8-464d-9605-08595d88739d","x":34,"y":238,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"5c1b43c2-412f-480b-81a7-8b920cd18c72","id":"eef4f4e5-1532-4801-893f-320498aeebea"}],"animations":[{"id":"00403851-dbb4-4e8e-a318-73690985b8a2","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["fe62ae10-dbd8-464d-9605-08595d88739d"]},{"id":"77b7c431-745c-437e-8d6e-b7fe6c45e48c","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["c81b0417-4d8e-476d-bb7e-1f6c1ee435af"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"49d1a0e5-24f3-4480-8601-91150e91946b","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"1100326d-c2c7-4dea-94d9-9ff6923ab56f","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"16169971-a896-4708-b356-8235d750cbac","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#d9d9d9","blurHash":"LVLqCFtm4n-o~qfixubJ?bxvt7oe","type":"image","mimeType":"image\/jpeg","creationDate":"2019-03-15T15:45:32Z","src":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=3600&h=2400&fit=max","width":3600,"height":2400,"id":"media\/unsplash:Oalh2MojUuk","alt":"woman placing sticky notes on wall","sizes":{"full":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=3600&h=2400&fit=max","mimeType":"image\/jpeg","width":3600,"height":2400},"large":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=2880&h=1920&fit=max","mimeType":"image\/jpeg","width":2880,"height":1920},"2160_1440":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=2160&h=1440&fit=max","mimeType":"image\/jpeg","width":2160,"height":1440},"1440_960":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=1440&h=960&fit=max","mimeType":"image\/jpeg","width":1440,"height":960},"720_480":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=720&h=480&fit=max","mimeType":"image\/jpeg","width":720,"height":480},"web_stories_thumbnail":{"file":"media\/unsplash:Oalh2MojUuk","sourceUrl":"https:\/\/images.unsplash.com\/photo-1552664730-d307ca884978?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMjJ8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjQ5Ng&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"Jason Goodman","url":"https:\/\/unsplash.com\/@jasongoodman_youxventures?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCFZPNdgf6NOEFrOBVtEQO5zhrX\/K8PCX%2B1SKmR9JDbRfj\/LD7GPujIomrPbnXyW6u\/j6hhEGjkq1Mm6QE\/NG4AUkr1WeNTI814h6UKMUFdfa4p1LWeuNrfgvr6Hu7n7eMeDFKKoj2w5Ytszpf3gwqTeHopjAcJJaRU0dY63\/yCbFhxJ0FPTlM8W7jULLp83Co%2Bp6tB\/aAcYC9bpFISLZzdginirL4yYVgXkzXj\/NYOeXBMgzVfRlltMHjbZVuMfwMF7"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"color: #fff\">3. Calculate the minimum path cycle using above step and return their minimum cost.<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":345,"height":106,"scale":100,"focalX":50,"focalY":50,"basedOn":"fe62ae10-dbd8-464d-9605-08595d88739d","id":"9efac827-d099-4bc2-a4f0-1f948d9c1cf3","x":34,"y":238,"groupId":null},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"eef4f4e5-1532-4801-893f-320498aeebea","id":"c976d164-4802-48d2-9abf-7ea67a33d85d"}],"animations":[{"id":"efd0a87f-c8f1-40d3-ba03-6c7bd569e752","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["9efac827-d099-4bc2-a4f0-1f948d9c1cf3"]},{"id":"5755b693-1efb-4181-a21f-32d16dc4b8fe","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["16169971-a896-4708-b356-8235d750cbac"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"ac210c64-2f3a-4766-a126-ee64cf4d58c8","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"fb4fd1e4-e752-4a64-b3c0-348948bebd51","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/Banner-3.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"c81b0417-4d8e-476d-bb7e-1f6c1ee435af","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#d9f3f3","blurHash":"LtI}kkyE%gWB~UtSWYjZ%1R.R*j@","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:31:26Z","src":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:Yp-X2Yba_14","alt":"two women sitting on gray sofa with laptops","sizes":{"full":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=4812&h=3212&fit=max","mimeType":"image\/jpeg","width":4812,"height":3212},"3609_2409":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=3609&h=2409&fit=max","mimeType":"image\/jpeg","width":3609,"height":2409},"2406_1606":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=2406&h=1606&fit=max","mimeType":"image\/jpeg","width":2406,"height":1606},"1203_803":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=1203&h=803&fit=max","mimeType":"image\/jpeg","width":1203,"height":803},"web_stories_thumbnail":{"file":"media\/unsplash:Yp-X2Yba_14","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165381639-1100ef3c5e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxNDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY2OTI5NjUzMw&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"attribution":{"author":{"displayName":"Christina @ wocintechchat.com","url":"https:\/\/unsplash.com\/@wocintechchat?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCEK8JiQbwymL8USrKPCAG\/lSuG2KROP4moAOViDTd\/CG\/ACWGXy%2BdLUwBOQBZOvbJqRSHa4HaYBqN7fd7CBy%2B7PIMj%2B6fNZJdmaPDMN2sXmbyClxGHs0qiuTTQGNURURkEPXnATYiXTS8xtIWsKWea9zjvK58K9U14fgIQGWvzFNv\/48kwXk2Edb1zTFPdFdy23i0LLeYOVqt\/d0AUujBiZxNeAdItO\/B\/LiFDNWArtx54WIP7%2BmCwxYaSv5\/O3PYHr"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"c976d164-4802-48d2-9abf-7ea67a33d85d","id":"b134620b-de67-4ae9-8c5e-7dd6d37a1cc9"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque","fallbacks":["sans-serif"],"weights":[300,400,500,600,700,800,900],"styles":["regular"],"variants":[[0,300],[0,400],[0,500],[0,600],[0,700],[0,800],[0,900]],"service":"fonts.google.com","metrics":{"upm":1000,"asc":1060,"des":-296,"tAsc":1060,"tDes":-296,"tLGap":0,"wAsc":1060,"wDes":296,"xH":406,"capH":563,"yMin":-296,"yMax":1060,"hAsc":1060,"hDes":-296,"lGap":0}},"fontSize":28,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"type":"text","content":"<span style=\"font-weight: 700; color: #e06e04\">Time complexity: <\/span><span style=\"color: #fff\">O(N^2*logN)&nbsp;<\/span>\n\n<span style=\"font-weight: 700; color: #e06e04\">Space complexity: <\/span><span style=\"color: #fff\">O(N)<\/span>","fontWeight":400,"borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":378,"height":106,"scale":100,"focalX":50,"focalY":50,"basedOn":"93dfa69b-ddd5-4ff2-92e4-23389755a69b","x":34,"y":255,"groupId":null,"id":"964edd49-8422-4ab2-abf3-b53492e50534"}],"animations":[{"targets":["964edd49-8422-4ab2-abf3-b53492e50534"],"id":"0a7e6553-73eb-498e-9e2e-97b0ff3490ae","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0},{"id":"829acf85-5491-4f4c-8ee6-be661fa53f51","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["c81b0417-4d8e-476d-bb7e-1f6c1ee435af"]}],"backgroundOverlay":"none","backgroundColor":{"color":{"r":18,"g":32,"b":54}},"type":"page","id":"0ef1df4c-e55c-4bc3-b1f8-e2dde6ce0e44","pageTemplateType":"section","groups":[],"defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"6d036328-cee0-44f4-8b26-ea8a1b6a560b","basedOn":"baa9276c-1206-430d-b0a3-68699a42dee3"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"Read More"}},{"elements":[{"x":48,"y":0,"width":330,"height":412,"type":"image","opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"mask":{"type":"rectangle"},"isBackground":true,"id":"ae3f6c5c-5c72-4ba8-b6bc-e71174f9ed50","basedOn":"5249418e-8fb7-46d7-8af1-835671d52f2b","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3f3f3","blurHash":"LIHCK5tkV@?aOv?uR.s,~VIU9EjX","type":"image","mimeType":"image\/jpeg","creationDate":"2020-01-19T03:05:44Z","src":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=3394&h=4243&fit=max","width":3394,"height":4243,"id":"media\/unsplash:QUHuwyNgSA0","alt":"media\/unsplash:QUHuwyNgSA0","sizes":{"full":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=3394&h=4243&fit=max","mimeType":"image\/jpeg","width":3394,"height":4243},"large":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=2715&h=3394&fit=max","mimeType":"image\/jpeg","width":2715,"height":3394},"2036_2545":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=2036&h=2545&fit=max","mimeType":"image\/jpeg","width":2036,"height":2545},"1357_1696":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=1357&h=1696&fit=max","mimeType":"image\/jpeg","width":1357,"height":1696},"678_848":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=678&h=848&fit=max","mimeType":"image\/jpeg","width":678,"height":848},"web_stories_thumbnail":{"file":"media\/unsplash:QUHuwyNgSA0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1579403124614-197f69d8187b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4fHxqYXZhfGVufDB8fHx8MTY2NjI1MTk3NQ&ixlib=rb-4.0.3&fm=jpg&w=340&h=425&fit=max","mimeType":"image\/jpeg","width":340,"height":425}},"attribution":{"author":{"displayName":"Karl Pawlowicz","url":"https:\/\/unsplash.com\/@karlp?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AQBR4tokwjXMFo3zs16NQJe4fFobYzTq0dSGG0EnvaudCIdqqdOJeRrn2ODkT2F0MFcScsKxTym1EvYZ0PwJWNcSgiArK6Yul%2BurUWWp8ZUV4AZf\/22sTlGIw8FoFmgHz5q5ePs9IdKWDfiIeXKvOUrrxGR6qCLYDYQwoGBKBdH3RfFvhiUasGHoqaLeKnWpghGXjQRwyyQPjr89DOCADJ4j0WchFPSEeoU2LiLI"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"x":48,"y":229,"width":263,"height":265,"font":{"family":"Anton","fallbacks":["sans-serif"],"weights":[400],"styles":["regular"],"variants":[[0,400]],"service":"fonts.google.com","metrics":{"upm":2048,"asc":2409,"des":-674,"tAsc":2409,"tDes":-674,"tLGap":0,"wAsc":2876,"wDes":674,"xH":1500,"capH":1760,"yMin":-667,"yMax":2874,"hAsc":2409,"hDes":-674,"lGap":0}},"type":"text","opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","scale":100,"focalX":50,"focalY":50,"basedOn":"457c0ed6-69da-43c4-ac59-1d1359d980b9","id":"021e0541-35be-4946-80af-40b0a2d780a0","content":"<span style=\"color: #faf4ea\">How to implement these solutions in different languages?<\/span>","fontSize":42,"padding":{"horizontal":0,"vertical":0},"tagName":"h2","marginOffset":-34.87060546875},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"type":"image","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/png","creationDate":"2021-07-12T14:57:03","src":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png","width":2130,"height":708,"id":724,"alt":"InterviewBit-White-2","sizes":{"medium":{"file":"InterviewBit-White-2-300x100.png","width":300,"height":100,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-300x100.png"},"large":{"file":"InterviewBit-White-2-1024x340.png","width":1024,"height":340,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1024x340.png"},"thumbnail":{"file":"InterviewBit-White-2-150x150.png","width":150,"height":150,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x150.png"},"medium_large":{"file":"InterviewBit-White-2-768x255.png","width":768,"height":255,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-768x255.png"},"1536x1536":{"file":"InterviewBit-White-2-1536x511.png","width":1536,"height":511,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-1536x511.png"},"2048x2048":{"file":"InterviewBit-White-2-2048x681.png","width":2048,"height":681,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-2048x681.png"},"web-stories-poster-portrait":{"file":"InterviewBit-White-2-640x708.png","width":640,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x708.png"},"web-stories-poster-landscape":{"file":"InterviewBit-White-2-853x640.png","width":853,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-853x640.png"},"web-stories-poster-square":{"file":"InterviewBit-White-2-640x640.png","width":640,"height":640,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-640x640.png"},"web-stories-publisher-logo":{"file":"InterviewBit-White-2-96x96.png","width":96,"height":96,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-96x96.png"},"web-stories-thumbnail":{"file":"InterviewBit-White-2-150x50.png","width":150,"height":50,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2-150x50.png"},"full":{"file":"InterviewBit-White-2.png","width":2130,"height":708,"mimeType":"image\/png","sourceUrl":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/07\/InterviewBit-White-2.png"}},"isOptimized":false,"isExternal":false},"basedOn":"84a9fe46-f171-471f-bb69-fb55fff093d6","id":"d8431b7e-175f-447d-8b3d-3fc64bb112fd"}],"animations":[{"id":"2d535ce0-b1ea-4b59-9afe-33fb43378ce5","type":"effect-fly-in","targets":["021e0541-35be-4946-80af-40b0a2d780a0"],"flyInDir":"bottomToTop","duration":1000,"delay":0}],"type":"page","id":"b2cd7624-c3ec-4a7d-9867-d7d4dc8f0933","backgroundColor":{"color":{"r":33,"g":31,"b":30}},"pageTemplateType":"section","defaultBackgroundElement":{"x":21,"y":64,"width":128,"height":128,"type":"shape","opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"mask":{"type":"rectangle"},"isBackground":true,"id":"097f0363-56a1-44b8-86bf-59f17f0b0720","isDefaultBackground":true,"basedOn":"5249418e-8fb7-46d7-8af1-835671d52f2b"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/travelling-salesman-problem\/?utm_source=Ib&utm_medium=travelling-salesman-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/09\/Travelling-Salesman-Problem.jpg","needsProxy":false,"ctaText":"SWIPE UP"}}],"autoAdvance":true,"defaultPageDuration":7,"currentStoryStyles":{"colors":[]}},"style_presets":{"colors":[{"color":{"r":157,"g":100,"b":32}},{"color":{"r":0,"g":0,"b":0}}],"textStyles":[]},"story_poster":{"id":14564,"url":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2022\/11\/cropped-travelling_salesman_problems.png","width":640,"height":853,"needsProxy":false},"_links":{"self":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/14553"}],"collection":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story"}],"about":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/wp\/v2\/types\/web-story"}],"author":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/users\/21"}],"version-history":[{"count":4,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/14553\/revisions"}],"predecessor-version":[{"id":14565,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/14553\/revisions\/14565"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/media\/14564"}],"wp:attachment":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/media?parent=14553"}],"wp:term":[{"taxonomy":"web_story_category","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web_story_category?post=14553"},{"taxonomy":"web_story_tag","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web_story_tag?post=14553"}],"wp:lock":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/14553\/lock"}],"wp:publisherlogo":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/media\/1082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}