{"id":15675,"date":"2023-01-18T19:56:44","date_gmt":"2023-01-18T14:26:44","guid":{"rendered":"https:\/\/www.interviewbit.com\/blog\/?post_type=web-story&#038;p=15675"},"modified":"2023-01-18T19:56:46","modified_gmt":"2023-01-18T14:26:46","slug":"how-to-solve-subset-sum-problem","status":"publish","type":"web-story","link":"https:\/\/www.interviewbit.com\/blog\/web-stories\/how-to-solve-subset-sum-problem\/","title":{"rendered":"How to solve Subset Sum 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=Roboto%3Awght%40400%3B700&amp;family=Darker+Grotesque%3Awght%40400%3B700&amp;family=Anton\" rel=\"stylesheet\"\/><link href=\"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2048&amp;h=1536&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>How to solve Subset Sum Problem?<\/title><link rel=\"canonical\" href=\"https:\/\/www.interviewbit.com\/blog\/?post_type=web-story&amp;p=15675\"\/><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=\"How to solve Subset Sum Problem?\" poster-portrait-src=\"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2023\/01\/cropped-subset-sum-problem-18th.png\"><amp-story-page id=\"d1e9a7c2-404d-415a-a2eb-eea40554940b\" 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:#0c2640\">\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-8713361c-f03a-487f-9a51-a0f98b9ddadb\">\n<div style=\"position:absolute;width:237.03704%;height:100%;left:-68.51852%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2048&amp;h=1536&amp;fit=max\" alt=\"geometric shape digital wallpaper\" srcSet=\"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2048&amp;h=1536&amp;fit=max 2048w,https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1638&amp;h=1229&amp;fit=max 1638w,https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1228&amp;h=921&amp;fit=max 1228w,https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=819&amp;h=614&amp;fit=max 819w,https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=409&amp;h=307&amp;fit=max 409w,https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=255&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 107vh, 238vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-image:linear-gradient(0.5turn, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%)\"><\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-image:linear-gradient(0.5turn, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%)\"><\/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-96332792-fe49-4105-a90e-4f4a9d61ad55\">\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:3.8835%;top:47.89644%;width:76.69903%;height:28.64078%;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.6329113924050633% 0.6329113924050633% 0.6329113924050633% 0.6329113924050633% \/ 1.1299435028248588% 1.1299435028248588% 1.1299435028248588% 1.1299435028248588%\" id=\"el-95a17566-0eff-4d0a-a9a1-c1eab9f25976\">\n<h1 id=\"how-to-solve-subset-sum-problem\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:-0.14339398734177217% 0;font-family:&quot;Roboto&quot;,sans-serif;font-size:0.809061em;line-height:1.19;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #fff\">How to solve Subset Sum Problem?<\/span><\/span><\/h1>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:5.58252%;top:78.31715%;width:91.26214%;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.5319148936170213% 0.5319148936170213% 0.5319148936170213% 0.5319148936170213% \/ 5.714285714285714% 5.714285714285714% 5.714285714285714% 5.714285714285714%\" id=\"el-cd5e9604-8a06-49c9-ac81-19784a284f87\">\n<h2 id=\"lets-dive-in\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:-0.11220079787234044% 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: #347eff\">Let&#8217;s dive in!<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:3.8835%;top:90.7767%;width:36.16505%;height:14.23948%;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-1635eb8e-c97a-4bdf-98ea-5a430567b7fd\">\n<div style=\"position:absolute;width:100%;height:127.98857%;left:0%;top:-13.99429%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAi\/arrow.gif\" alt=\"Arrow Sticker\" srcSet=\"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAi\/arrow.gif 127w,https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAk\/arrow.gif 90w\" sizes=\"(min-width: 1024px) 16vh, 36vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/amp-story-grid-layer><\/amp-story-page><amp-story-page id=\"a412ae9b-93e4-4d0f-914d-16542b5684fc\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-032fb6a5-a889-4a9d-8fcf-f9d31e9e2e6f [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-42c9ca6f-928a-4935-a745-beda512d5da4\",\"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-09c839a4-9440-4783-9e93-903a1bd5ae39\",\"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-fe6df29e-8091-4d16-a165-d59d050dda4a\",\"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-80e8ff9d-1cf8-43f8-9312-66e443972c42\",\"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-032fb6a5-a889-4a9d-8fcf-f9d31e9e2e6f\" 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-0261f38d-d8bd-4b47-9896-610bb81df005\">\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-1631624210938-539575f92e3c?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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: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-61b32cde-1c85-4a55-adbb-d0e5621c0185\">\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.49515%;top:36.40777%;width:83.25243%;height:41.58576%;opacity:1\">\n<div id=\"anim-42c9ca6f-928a-4935-a745-beda512d5da4\" 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-09c839a4-9440-4783-9e93-903a1bd5ae39\" 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.7782101167315175% 0.7782101167315175% 0.7782101167315175% 0.7782101167315175%\" id=\"el-4f14ba1f-d23d-45d8-8111-4a0de6353f74\">\n<h2 id=\"its-a-problem-where-youre-given-an-array-a-a1-a2-a3an-of-positive-integers-and-you-need-to-find-a-subset-of-the-array-such-that-the-sum-of-the-elements-in-that-subset-is-eq\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6822157434402332% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">It&#8217;s a problem where you&#8217;re given an array A = (A1 A2 A3\u2026An) of positive integers, and you need to find a subset of the array such that the sum of the elements in that subset is equal to some positive integers.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:4.69256%;width:99.51456%;height:25.24272%;opacity:1\">\n<div id=\"anim-fe6df29e-8091-4d16-a165-d59d050dda4a\" 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-80e8ff9d-1cf8-43f8-9312-66e443972c42\" 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.4878048780487805% 0.4878048780487805% 0.4878048780487805% 0.4878048780487805% \/ 1.282051282051282% 1.282051282051282% 1.282051282051282% 1.282051282051282%;background-clip:content-box;background-color:#052258\" id=\"el-7f5143b8-6b83-4d67-8600-c66ffe9d9e4d\">\n<h1 id=\"ever-heard-of-subset-sum-problem\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.613658536585366% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.760518em;line-height:0.9;text-align:center;padding:0.975609756097561% 1.951219512195122%;color:#000000\"><span><span style=\"font-weight: 700; color: #3372e0\">Ever heard of Subset-Sum Problem?<\/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\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Learn more<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"ae40903e-5d0a-4461-bb14-d9db3bfd6b21\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-fe025a26-1e4d-411b-9d01-255f8c5b64d7\",\"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-afb8df12-d391-47aa-8366-5cdaf0a57c63\",\"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-b321efd7-ef60-425e-a548-f2f30e8600a4 [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-5e00d6a4-d7ac-45e7-acf0-faf2ffbdfc6f\",\"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-ee7bdc01-357e-41af-ac8f-c4eab3eefee3\",\"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-b321efd7-ef60-425e-a548-f2f30e8600a4\" 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-76638dd5-e923-4c37-8934-99f03447a159\">\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-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"woman in black shirt using laptop computer\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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-a3bb84b5-e208-4e2a-936f-5611c92d7d16\">\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:7.76699%;top:34.46602%;width:85.43689%;height:35.76052%;opacity:1\">\n<div id=\"anim-fe025a26-1e4d-411b-9d01-255f8c5b64d7\" 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-afb8df12-d391-47aa-8366-5cdaf0a57c63\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 0.904977375565611% 0.904977375565611% 0.904977375565611% 0.904977375565611%\" id=\"el-01463911-9ace-441d-a6f8-4307552a5552\">\n<h2 id=\"given-an-array-of-non-negative-integers-and-an-integer-sum-can-you-determine-if-there-exists-any-subset-in-the-array-whose-sum-is-equal-to-the-given-integer-sum\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">Given an array of non-negative integers and an integer sum, can you determine if there exists any subset in the array whose sum is equal to the given integer sum?<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:4.69256%;width:99.51456%;height:11.65049%;opacity:1\">\n<div id=\"anim-5e00d6a4-d7ac-45e7-acf0-faf2ffbdfc6f\" 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-ee7bdc01-357e-41af-ac8f-c4eab3eefee3\" 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.4878048780487805% 0.4878048780487805% 0.4878048780487805% 0.4878048780487805% \/ 2.7777777777777777% 2.7777777777777777% 2.7777777777777777% 2.7777777777777777%;background-clip:content-box;background-color:#052258\" id=\"el-bf868b6a-256e-480a-bfe1-970aef991286\">\n<h1 id=\"problem-statement\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.613658536585366% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.760518em;line-height:0.9;text-align:center;padding:0.975609756097561% 1.951219512195122%;color:#000000\"><span><span style=\"font-weight: 700; color: #3372e0\">Problem Statement<\/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\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Find out now<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"89c46d12-909f-4a7b-b582-777f409a4ac2\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-efec6c18-9310-4edf-bd1c-f1a20bfa761b\",\"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-2f679be3-bc45-497e-8471-0803f2f335f2\",\"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-c533c591-68b0-4ec5-83b2-94d9b1f55e3d [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-da062f4d-83e3-421d-b872-be0fd20d2c92\",\"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-3849aedb-cb6a-4c35-b1c1-a46a8ed054d4\",\"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:#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-c533c591-68b0-4ec5-83b2-94d9b1f55e3d\" 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-76638dd5-e923-4c37-8934-99f03447a159\">\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-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"photography of three women sits beside table inside room during daytime\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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-90701d05-70b8-48ba-9066-72199e99b3ce\">\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:9.46602%;top:17.79935%;width:85.43689%;height:18.28479%;opacity:1\">\n<div id=\"anim-efec6c18-9310-4edf-bd1c-f1a20bfa761b\" 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-2f679be3-bc45-497e-8471-0803f2f335f2\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 1.7699115044247788% 1.7699115044247788% 1.7699115044247788% 1.7699115044247788%\" id=\"el-94bfec13-62c1-4925-8c9b-5e13821d634a\">\n<h2 id=\"lets-take-an-example-to-understand-the-problem-better\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #347eff\">Let&#8217;s take an example to understand the problem better.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:9.46602%;top:43.20388%;width:85.43689%;height:29.77346%;opacity:1\">\n<div id=\"anim-da062f4d-83e3-421d-b872-be0fd20d2c92\" 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-3849aedb-cb6a-4c35-b1c1-a46a8ed054d4\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 1.0869565217391304% 1.0869565217391304% 1.0869565217391304% 1.0869565217391304%\" id=\"el-beb9cd08-b670-4372-bebb-c5ab5af8e430\">\n<h2 id=\"input-arr-3-34-4-12-3-2-sum-7-output-true-explanation-there-is-a-subset-4-3-with-sum-7\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">Input: arr[] = {3, 34, 4, 12, 3, 2}, sum = 7&nbsp;<\/span><br \/>\n<span style=\"color: #fff\">Output: True&nbsp;<\/span><br \/>\n<span style=\"color: #fff\">Explanation: There is a subset (4, 3) with sum 7. &nbsp;<\/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\/10\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Check more examples<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"de3e1538-90d1-44c3-9dc1-e9eb15aea441\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-e54cfc97-8b66-43c1-ae5d-ca9f62ab8166\",\"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-2bcdeedb-1ef8-45fc-b40a-c12bea21f820\",\"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-912f4a67-f6b7-4950-a9bf-1f7946143cc8 [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-a175de41-94aa-4717-8bb3-76c0a55a3293\",\"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-dabb4153-d2e2-4d44-8bff-bd1a9d5c20c5\",\"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:#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-912f4a67-f6b7-4950-a9bf-1f7946143cc8\" 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-76638dd5-e923-4c37-8934-99f03447a159\">\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-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"photography of people inside room during daytime\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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-ca607fc3-47ce-46f2-be0f-336346011aab\">\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.73786%;top:26.69903%;width:82.76699%;height:41.58576%;opacity:1\">\n<div id=\"anim-e54cfc97-8b66-43c1-ae5d-ca9f62ab8166\" 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-2bcdeedb-1ef8-45fc-b40a-c12bea21f820\" 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.5865102639296188% 0.5865102639296188% 0.5865102639296188% 0.5865102639296188% \/ 0.7782101167315175% 0.7782101167315175% 0.7782101167315175% 0.7782101167315175%\" id=\"el-91e1f96d-98c1-4640-bbd8-2ceb2f611100\">\n<h2 id=\"this-approach-is-based-on-two-cases-1-take-last-element-calculate-sum-target-sum-value-of-last-element-elements-remaining-size-of-array-1\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6862170087976539% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">This approach is based on two cases- &nbsp;&nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">1. Take last element &amp; calculate sum = target sum &#8211; value of last element &amp; elements remaining = size of array &#8211; 1.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:4.69256%;width:99.51456%;height:11.65049%;opacity:1\">\n<div id=\"anim-a175de41-94aa-4717-8bb3-76c0a55a3293\" 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-dabb4153-d2e2-4d44-8bff-bd1a9d5c20c5\" 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.4878048780487805% 0.4878048780487805% 0.4878048780487805% 0.4878048780487805% \/ 2.7777777777777777% 2.7777777777777777% 2.7777777777777777% 2.7777777777777777%;background-clip:content-box;background-color:#052258\" id=\"el-9c230cad-a36e-4bfe-864b-cdbff9f1f09e\">\n<h1 id=\"recursive-approach\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.613658536585366% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.760518em;line-height:0.9;text-align:center;padding:0.975609756097561% 1.951219512195122%;color:#000000\"><span><span style=\"font-weight: 700; color: #3372e0\">Recursive 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\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Read more<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"9e5d6a53-c17c-415a-b590-e6df6d6fd3f4\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-df06c1bf-4e02-4cdb-8aee-df6f4c700697 [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-0826706a-a9bc-4011-b6ea-c2c11702e8d9\",\"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-bbfde476-0fb3-4a61-b7b2-d5d46d4c938d\",\"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:#f3a673\">\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-df06c1bf-4e02-4cdb-8aee-df6f4c700697\" 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-27f2951c-8b6e-4772-8cc9-8a5b431fd5c6\">\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-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"people sitting beside rectangular brown table with laptops\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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-f24b57dc-e5b9-416a-be22-4a071ebd4794\">\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:7.03883%;top:35.27508%;width:85.43689%;height:24.11003%;opacity:1\">\n<div id=\"anim-0826706a-a9bc-4011-b6ea-c2c11702e8d9\" 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-bbfde476-0fb3-4a61-b7b2-d5d46d4c938d\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 1.342281879194631% 1.342281879194631% 1.342281879194631% 1.342281879194631%\" id=\"el-9cdf83be-84a7-4e37-9e13-228230d7f1b6\">\n<h2 id=\"2-dont-take-last-element-calculate-the-sum-target-sum-elements-remaining-size-of-array-1\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">2. Don&#8217;t take last element &amp; calculate the sum = target sum &amp; elements remaining = size of array &#8211; 1.<\/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\/10\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">See code implementation<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"cf434d3e-3132-4b3c-87e0-5ae80860d37a\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-e5db245a-a591-41b4-aa20-726439aab33f [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-e6df2382-3b98-4f26-9d5d-5c79279d80a3\",\"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-1af24376-a3d2-49df-a4cd-e7b7259e2940\",\"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-e5db245a-a591-41b4-aa20-726439aab33f\" 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-4bea2dab-2033-49a6-a9a8-b6dc345abb9c\">\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-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max\" alt=\"three women sitting beside wooden table\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=6016&amp;h=4016&amp;fit=max 6016w,https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4812&amp;h=3212&amp;fit=max 4812w,https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3609&amp;h=2409&amp;fit=max 3609w,https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2406&amp;h=1606&amp;fit=max 2406w,https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1203&amp;h=803&amp;fit=max 1203w,https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&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-2ad5ac42-0aab-4934-a886-dd828e311d1a\">\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:26.53722%;width:85.43689%;height:41.58576%;opacity:1\">\n<div id=\"anim-e6df2382-3b98-4f26-9d5d-5c79279d80a3\" 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-1af24376-a3d2-49df-a4cd-e7b7259e2940\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 0.7782101167315175% 0.7782101167315175% 0.7782101167315175% 0.7782101167315175%\" id=\"el-10752c12-70a7-4a16-8ef9-0e5287245dc9\">\n<h2 id=\"time-complexity-of-recursive-approach-the-time-complexity-of-this-approach-is-exponential-but-why-click-on-the-link-below-to-find-out-the-answer\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #347eff\">Time complexity of Recursive Approach&nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">The time complexity of this approach is exponential, but why? Click on the link below to find out the answer.<\/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\/10\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Explore now<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"015ce16c-01eb-4503-a5fd-c69fd2ace5d2\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-5f0d7cf1-aa6b-4fdc-839b-c0030cdf71e2\",\"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-c0b2e0f8-19d3-40b0-a78f-6a2873695f6d\",\"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-60738642-31cf-45c2-84be-cd5a5c29a960 [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-90a7fa97-adc9-438b-a4c9-d2952391fb60\",\"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-7dad22f3-1f27-4596-98e9-c8113d7a6db6\",\"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:#a6c0c0\">\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-60738642-31cf-45c2-84be-cd5a5c29a960\" 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-07cb1230-628a-4b45-910c-b13bf7f662ea\">\n<div style=\"position:absolute;width:133.38261%;height:100%;left:-16.6913%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2707&amp;h=3608&amp;fit=max\" alt=\"man in blue hoodie looking at macbook\" srcSet=\"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2707&amp;h=3608&amp;fit=max 2707w,https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2165&amp;h=2886&amp;fit=max 2165w,https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1624&amp;h=2165&amp;fit=max 1624w,https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1082&amp;h=1442&amp;fit=max 1082w,https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=541&amp;h=721&amp;fit=max 541w,https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=453&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 60vh, 134vw\" 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-ddd85b20-5151-46db-b5aa-6c37b1273284\">\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:9.46602%;top:35.43689%;width:85.43689%;height:47.411%;opacity:1\">\n<div id=\"anim-5f0d7cf1-aa6b-4fdc-839b-c0030cdf71e2\" 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-c0b2e0f8-19d3-40b0-a78f-6a2873695f6d\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 0.6825938566552902% 0.6825938566552902% 0.6825938566552902% 0.6825938566552902%\" id=\"el-5a80f896-83ce-48d0-b555-413c716f09c1\">\n<h2 id=\"1-make-a-2d-array-of-size-equal-to-size-of-array-1-target-sum-1-of-boolean-type-2-the-state-dpij-will-be-true-if-there-is-a-subset-of-elements-from-a0-i-with-a-sum-v\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #fff\">1. Make a 2D array of size equal to (size of array + 1) * (target sum + 1) of boolean type. &nbsp;<\/span><\/p>\n<p><span style=\"color: #fff\">2. The state dp[i][j] will be true if there is a subset of elements from A[0\u2026.i] with a sum value equal to j.<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:0;top:4.69256%;width:99.51456%;height:25.24272%;opacity:1\">\n<div id=\"anim-90a7fa97-adc9-438b-a4c9-d2952391fb60\" 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-7dad22f3-1f27-4596-98e9-c8113d7a6db6\" 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.4878048780487805% 0.4878048780487805% 0.4878048780487805% 0.4878048780487805% \/ 1.282051282051282% 1.282051282051282% 1.282051282051282% 1.282051282051282%;background-clip:content-box;background-color:#052258\" id=\"el-a727cbf9-964e-41bd-b669-dbd2d8feaaa7\">\n<h1 id=\"dynamic-programming-approach\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:2.613658536585366% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.760518em;line-height:0.9;text-align:center;padding:0.975609756097561% 1.951219512195122%;color:#000000\"><span><span style=\"font-weight: 700; color: #3372e0\">Dynamic Programming 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\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Check the algorithm<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"8df77031-9e15-4779-a2a9-fe68c9e86633\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-96650be9-aa25-429c-bef5-74a9777e5167\",\"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-c4812063-806b-4f21-a231-e06ece5fa825\",\"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-11ec9298-71c8-47b9-8893-6ad5227b9295 [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-11ec9298-71c8-47b9-8893-6ad5227b9295\" 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-abc994fd-18e5-4821-9439-6a805f711046\">\n<div style=\"position:absolute;width:118.67612%;height:100%;left:-9.33806%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4016&amp;h=6016&amp;fit=max\" alt=\"shallow focus photo of woman using gray laptop computer\" srcSet=\"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4016&amp;h=6016&amp;fit=max 4016w,https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3212&amp;h=4812&amp;fit=max 3212w,https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2409&amp;h=3609&amp;fit=max 2409w,https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1606&amp;h=2406&amp;fit=max 1606w,https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=803&amp;h=1203&amp;fit=max 803w,https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=509&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: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-0a76cce9-5584-441b-bdfc-8adb40d0cc18\">\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:7.28155%;top:33.81877%;width:85.43689%;height:29.77346%;opacity:1\">\n<div id=\"anim-96650be9-aa25-429c-bef5-74a9777e5167\" 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-c4812063-806b-4f21-a231-e06ece5fa825\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 1.0869565217391304% 1.0869565217391304% 1.0869565217391304% 1.0869565217391304%\" id=\"el-68dc11dc-e204-44c0-b174-4c7e4f8d8ead\">\n<h2 id=\"time-complexity-on-sum-where-n-is-array-size-space-complexity-on-sum-where-n-is-array-size\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:0.6647727272727272% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #347eff\">Time Complexity: <\/span><span style=\"color: #fff\">O(N * sum) where N is array size.<\/span><span style=\"color: #347eff\">&nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 700; color: #347eff\">Space Complexity:<\/span><span style=\"color: #347eff\"> <\/span><span style=\"color: #fff\">O(N * sum) where N is array size.<\/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\/10\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-problem&amp;utm_campaign=webstories\" rel=\"\">Explore now<\/a><\/amp-story-page-outlink><\/amp-story-page><amp-story-page id=\"936b559d-4dc0-423a-9d89-b4d4ba99b081\" auto-advance-after=\"7s\"><amp-story-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-1f177cbf-0db1-4997-a492-5684d0eba673\",\"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-49cb1030-86bc-42b4-ac1a-d1d376021cee\",\"keyframes\":{\"transform\":[\"translate3d(-112.4161%, 0px, 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-animation layout=\"nodisplay\" trigger=\"visibility\"><script type=\"application\/json\">[{\"selector\":\"#anim-23a7b9ce-71a4-45cd-9108-6f8b7f38af72\",\"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-f5d3e2e1-5cbb-440f-9dfb-74e324e3d4d6\",\"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:#0c2626\">\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-07cb1230-628a-4b45-910c-b13bf7f662ea\">\n<div style=\"position:absolute;width:267.16887%;height:100%;left:-83.58443%;top:0%\" data-leaf-element=\"true\"><amp-img layout=\"fill\" src=\"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4256&amp;h=2832&amp;fit=max\" alt=\"photo of outer space\" srcSet=\"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=4256&amp;h=2832&amp;fit=max 4256w,https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=3404&amp;h=2265&amp;fit=max 3404w,https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=2553&amp;h=1699&amp;fit=max 2553w,https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=1702&amp;h=1133&amp;fit=max 1702w,https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=851&amp;h=566&amp;fit=max 851w,https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&amp;ixlib=rb-4.0.3&amp;fm=jpg&amp;w=340&amp;h=226&amp;fit=max 340w\" sizes=\"(min-width: 1024px) 121vh, 268vw\" disable-inline-width=\"true\"><\/amp-img><\/div>\n<div class=\"element-overlay-area\" style=\"background-color:rgba(0,0,0,0.4)\"><\/div>\n<\/div>\n<\/div>\n<div class=\"page-background-overlay-area\" style=\"background-color:rgba(0,0,0,0.4)\"><\/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-380e77ec-becc-4e13-b03c-a3c1bed377c3\">\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.98058%;top:39.15858%;width:72.3301%;height:38.83495%;opacity:1\">\n<div id=\"anim-1f177cbf-0db1-4997-a492-5684d0eba673\" 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-49cb1030-86bc-42b4-ac1a-d1d376021cee\" class=\"animation-wrapper\" style=\"width:100%;height:100%;display:block;position:absolute;top:0;left:0;--initial-opacity:1;--initial-transform:translate3d(-112.4161%, 0px, 0)\">\n<div style=\"pointer-events:initial;width:100%;height:100%;display:block;position:absolute;top:0;left:0;z-index:0\" id=\"el-3842812c-d804-48f9-b479-cbae6e5ee4fe\">\n<h2 id=\"want-to-explore-these-approaches-and-learn-how-to-implement-them-in-various-programming-languages\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:1.6395763422818794% 0;font-family:&quot;Anton&quot;,sans-serif;font-size:0.517799em;line-height:1.2;text-align:left;padding:0;color:#000000\"><span><span style=\"color: #faf4ea\">Want to explore these approaches and learn how to implement them in various programming languages?<\/span><\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"position:absolute;pointer-events:none;left:8.00971%;top:77.6699%;width:85.43689%;height:11.97411%;opacity:1\">\n<div id=\"anim-23a7b9ce-71a4-45cd-9108-6f8b7f38af72\" 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-f5d3e2e1-5cbb-440f-9dfb-74e324e3d4d6\" 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.5681818181818182% 0.5681818181818182% 0.5681818181818182% 0.5681818181818182% \/ 2.7027027027027026% 2.7027027027027026% 2.7027027027027026% 2.7027027027027026%\" id=\"el-faf98ac9-3bde-42ce-ba57-b4ed553c9aaf\">\n<h2 id=\"click-on-the-link-below-to-start-your-journey\" class=\"fill text-wrapper\" style=\"white-space:pre-line;overflow-wrap:break-word;word-break:break-word;margin:1.0909090909090908% 0;font-family:&quot;Darker Grotesque&quot;,sans-serif;font-size:0.485437em;line-height:1.1;text-align:left;padding:0;color:#000000\"><span><span style=\"font-weight: 700; color: #347eff\">Click on the link below to start your journey.<\/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\/10\/14-Subset-Sum-Problem.jpg\"><a href=\"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&amp;utm_medium=subset-sum-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":"In this web story, we will show you what is subset sum problem and how to solve it using different approaches. Also, how to implement this in different programming languages.\n","protected":false},"author":21,"featured_media":15677,"template":"","meta":{"_daextam_enable_autolinks":"","web_stories_products":[],"web_stories_publisher_logo":1082,"web_stories_poster":[]},"web_story_category":[1944],"web_story_tag":[2168],"amp_enabled":false,"story_data":{"version":46,"pages":[{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":247,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"8713361c-f03a-487f-9a51-a0f98b9ddadb","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#0c2640","blurHash":"L32F_aR4MItmROkCt8WAMHo#tmVs","type":"image","mimeType":"image\/jpeg","creationDate":"2018-04-17T10:34:35Z","src":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=2048&h=1536&fit=max","width":2048,"height":1536,"id":"media\/unsplash:oyXis2kALVg","alt":"geometric shape digital wallpaper","sizes":{"full":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=2048&h=1536&fit=max","mimeType":"image\/jpeg","width":2048,"height":1536},"large":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=1638&h=1229&fit=max","mimeType":"image\/jpeg","width":1638,"height":1229},"1228_921":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=1228&h=921&fit=max","mimeType":"image\/jpeg","width":1228,"height":921},"819_614":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=819&h=614&fit=max","mimeType":"image\/jpeg","width":819,"height":614},"409_307":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=409&h=307&fit=max","mimeType":"image\/jpeg","width":409,"height":307},"web_stories_thumbnail":{"file":"media\/unsplash:oyXis2kALVg","sourceUrl":"https:\/\/images.unsplash.com\/photo-1523961131990-5ea7c61b2107?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=340&h=255&fit=max","mimeType":"image\/jpeg","width":340,"height":255}},"attribution":{"author":{"displayName":"fabio","url":"https:\/\/unsplash.com\/@fabioha?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AXhJFEce%2BzWZmFhsx%2BwKiMk\/TFXpJ1tVoa1hIN%2BDsa2yY1QPy7IzOuDP0Lpq%2BWC4PfcYVTdKXcdjn3e8QHkxqHyYukjVlhRB%2Bb0XtSZ\/l9REc3wmE8jmw6MHTFZpVDZ2UBowVcJzY3c8UkrIYQ6IXxjYGK5G3BMTfOea2Vx2h5lDFGHp7WHpCvFFad5PzzFm2ysgK0srrUclNhvCpb7QbkLG4rJJzeneTzBvjfuqUcMyVE4K6hc%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"type":"linear","rotation":0,"stops":[{"color":{"r":0,"g":0,"b":0,"a":0},"position":0.4},{"color":{"r":0,"g":0,"b":0,"a":1},"position":1}],"alpha":0.5}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"bcb61e91-e319-4af6-9942-761a6dccae4d","id":"96332792-fe49-4105-a90e-4f4a9d61ad55","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Roboto"},"fontSize":50,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.19,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":0,"vertical":0},"content":"<span style=\"font-weight: 700; color: #fff\">How to solve Subset Sum Problem?<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":16,"y":296,"width":316,"height":177,"basedOn":"d3a60bc4-7153-47e4-b0a7-e025488ebee6","id":"95a17566-0eff-4d0a-a9a1-c1eab9f25976","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Roboto"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":0,"vertical":0},"content":"<span style=\"color: #347eff\">Let's dive in!<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":23,"y":484,"width":376,"height":35,"basedOn":"e5b0ef4a-2875-4ea0-b76a-2e4842af3a52","id":"cd5e9604-8a06-49c9-ac81-19784a284f87","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":false,"scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#c9c9c9","type":"image","mimeType":"image\/gif","creationDate":"2021-06-15T20:48:37Z","src":"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAi\/arrow.gif","width":127,"height":96,"id":"media\/tenor:17502271734916881333","alt":"Arrow Sticker","sizes":{"full":{"file":"media\/tenor:17502271734916881333","sourceUrl":"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAi\/arrow.gif","mimeType":"image\/gif","width":127,"height":96},"large":{"file":"media\/tenor:17502271734916881333","sourceUrl":"https:\/\/c.tenor.com\/8uSPaXIUm7UAAAAq\/tenor.gif","mimeType":"image\/gif","width":127,"height":96},"127_96":{"file":"media\/tenor:17502271734916881333","sourceUrl":"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAj\/arrow.gif","mimeType":"image\/gif","width":127,"height":96},"web_stories_thumbnail":{"file":"media\/tenor:17502271734916881333","sourceUrl":"https:\/\/media.tenor.com\/8uSPaXIUm7UAAAAk\/arrow.gif","mimeType":"image\/gif","width":90,"height":68}},"attribution":{"author":{"displayName":"BaqueG","url":"https:\/\/tenor.com\/users\/BaqueG"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AWJwhCGn%2BblUDo95R408YCZKIfyn7yyguspEYe\/\/fKJgzBIWZN0ChVCN8Rsn9SkHv8fUjZj07Pze7bYjLhpJnosB5yKEcbo%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"x":16,"y":561,"width":149,"height":88,"mask":{"type":"rectangle","showInLibrary":true,"name":"Rectangle","path":"M 0,0 1,0 1,1 0,1 0,0 Z","ratio":1,"supportsBorder":true},"basedOn":"3f59b2d3-ad4a-43b4-af04-92e0f580c1f9","id":"1635eb8e-c97a-4bdf-98ea-5a430567b7fd","type":"image"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"id":"d1e9a7c2-404d-415a-a2eb-eea40554940b","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"0261f38d-d8bd-4b47-9896-610bb81df005"},"animations":[]},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"0261f38d-d8bd-4b47-9896-610bb81df005","scale":100,"focalX":50,"focalY":50,"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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=MnwxMzcxOTN8MHwxfHNlYXJjaHwyNHx8c29mdHdhcmUlMjBkZXZlbG9wbWVudHxlbnwwfHx8fDE2NjYwMDQwNzM&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=AQBR4trhsTBxm\/6gFbgX28yUJ7OS1W92A8NS56%2BLfPfFRmKWvhaCR1BqvtSBkOcWIjMMjaxrNaqCqJHjmNaY4DaaySGy7ArbHIsHLc6GUrXW2rGtkMNlXAhfzs8SATbBi4Ipg5R0XCJtI2D8GL1TwOck4hyBeHMlsR\/RSXRV3gUb%2B338sGPFnHKqnHloW1njXhLYwYR4a4j3Ba5sQ\/rB1BEjQKKnZYfGLTfgm1RVdYakMLP7jr46I\/8EIUTfjlWIlPFyRs3rsA%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,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"96332792-fe49-4105-a90e-4f4a9d61ad55","id":"61b32cde-1c85-4a55-adbb-d0e5621c0185","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">It's a problem where you're given an array A = (A1 A2 A3\u2026An) of positive integers, and you need to find a subset of the array such that the sum of the elements in that subset is equal to some positive integers.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":343,"height":257,"basedOn":"a5310a1f-42e0-44e1-b9bb-ecc0fd66e344","x":35,"y":225,"groupId":null,"id":"4f14ba1f-d23d-45d8-8111-4a0de6353f74","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque"},"fontSize":47,"backgroundColor":{"color":{"r":5,"g":34,"b":88}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"content":"<span style=\"font-weight: 700; color: #3372e0\">Ever heard of Subset-Sum Problem?<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":29,"width":410,"height":156,"marginOffset":-33.45600000000001,"basedOn":"d5676f0b-0f33-47be-a306-a2d262bd0aa1","groupId":null,"id":"7f5143b8-6b83-4d67-8600-c66ffe9d9e4d","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"226b04c7-e125-4c82-8f2b-18b7f9839e4c","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["0261f38d-d8bd-4b47-9896-610bb81df005"]},{"id":"a72a6575-272a-4b2f-96cb-e8de1225eac4","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["4f14ba1f-d23d-45d8-8111-4a0de6353f74"]},{"targets":["7f5143b8-6b83-4d67-8600-c66ffe9d9e4d"],"id":"a63ad3a7-e2a6-4e27-9ff6-48859cbbd1ad","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"id":"a412ae9b-93e4-4d0f-914d-16542b5684fc","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"76638dd5-e923-4c37-8934-99f03447a159"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"76638dd5-e923-4c37-8934-99f03447a159","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#262626","blurHash":"LFAmC_58$%I:~VE2t8W?WrflIo%1","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:13:50Z","src":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:L85a1k-XqH8","alt":"woman in black shirt using laptop computer","sizes":{"full":{"file":"media\/unsplash:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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:L85a1k-XqH8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164713712-03790a178651?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzNXx8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY2NjM2MDY5Ng&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=AQBR4tpUK7LmuVs8hywyG7ZNT\/IANFQMT5EQVFmKXUhmFGJLcYOybJyAHjY5cN7LFcg7\/au35WOJNwQa8eFQErZFjDPC09pKVbcd7nFwi4Dne6aJ\/agIcZvksCWUxhFQRuXH8Lqv89gRqDmAwh1d0MLN\/9e6EOXZ\/1n4ZlYPaSWSIHgSXZJvPnoi8FQcrOShyJqInuAHqCREV07vTahGggYgiw\/MG1Clw7Kbb%2BGCxpQYdAzcxRorXs5\/MGm4\/d5uHS8vkKrc"},"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,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"61b32cde-1c85-4a55-adbb-d0e5621c0185","id":"a3bb84b5-e208-4e2a-936f-5611c92d7d16","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">Given an array of non-negative integers and an integer sum, can you determine if there exists any subset in the array whose sum is equal to the given integer sum?<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":221,"basedOn":"f97fd49e-97ee-4616-af20-f3080ddf1fb7","x":32,"y":213,"groupId":null,"id":"01463911-9ace-441d-a6f8-4307552a5552","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque"},"fontSize":47,"backgroundColor":{"color":{"r":5,"g":34,"b":88}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"content":"<span style=\"font-weight: 700; color: #3372e0\">Problem Statement<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":29,"width":410,"height":72,"marginOffset":-33.45600000000001,"basedOn":"7f5143b8-6b83-4d67-8600-c66ffe9d9e4d","groupId":null,"id":"bf868b6a-256e-480a-bfe1-970aef991286","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"c31d02c8-b413-4318-a5d0-16b804300858","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["01463911-9ace-441d-a6f8-4307552a5552"]},{"id":"9378c669-de46-4b31-8918-7ba002c39f3e","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["76638dd5-e923-4c37-8934-99f03447a159"]},{"targets":["bf868b6a-256e-480a-bfe1-970aef991286"],"id":"52bdfda1-4c85-4c3f-9bf7-0eecb013e063","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"id":"ae40903e-5d0a-4461-bb14-d9db3bfd6b21","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"01a3f12e-8e51-4c1f-a11e-a008881031f6"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Find out now"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"76638dd5-e923-4c37-8934-99f03447a159","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3f3f3","blurHash":"LWMZ{[?wH?%g?ufmo|x]v}Nw-pW;","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:10:23Z","src":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:UcZcsHSp8o4","alt":"photography of three women sits beside table inside room during daytime","sizes":{"full":{"file":"media\/unsplash:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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:UcZcsHSp8o4","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574397-dd250bc8a598?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw3OHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjcwMzM2Mjk2&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=AWJwhCECO\/YKgPJJp2cmQoF6fUCVlaVawJi1ntit\/8j7ClCj7cknUXKaOpOp1thzacWJX4pSUqZ9Y4fmKuDsNeyKx0XmP30KEVz1kWhBqH4iEXS8SDPA\/RxBUrcYV0DlIj4xoeNyBGn\/B5NXfm\/1TL01QkeZrI7Gtv1WSwTL6DhBA7Uc3OHvyaOY2XzssGoVYPC%2BBYvcw3Inmf9P4%2BUsso64vm\/JnRKnuabILESqBgWi5devJHX2fmloIpytkA4Zh\/E5HA%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,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"a3bb84b5-e208-4e2a-936f-5611c92d7d16","id":"90701d05-70b8-48ba-9066-72199e99b3ce","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"font-weight: 700; color: #347eff\">Let's take an example to understand the problem better.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":113,"basedOn":"861b8e8e-f3c3-4a43-b68e-3e3422474d74","x":39,"y":110,"groupId":null,"id":"94bfec13-62c1-4925-8c9b-5e13821d634a","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">Input: arr[] = {3, 34, 4, 12, 3, 2}, sum = 7&nbsp;<\/span>\n<span style=\"color: #fff\">Output: True&nbsp;<\/span>\n<span style=\"color: #fff\">Explanation: There is a subset (4, 3) with sum 7. &nbsp;<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":184,"basedOn":"94bfec13-62c1-4925-8c9b-5e13821d634a","x":39,"y":267,"groupId":null,"id":"beb9cd08-b670-4372-bebb-c5ab5af8e430","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"a129a4c7-421b-4505-8ee3-1f4e75e4a644","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["94bfec13-62c1-4925-8c9b-5e13821d634a"]},{"id":"0982aa78-ae67-43a7-a657-68a501969d69","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["76638dd5-e923-4c37-8934-99f03447a159"]},{"id":"125d0481-b8ed-4e8a-a717-01c0d72336d0","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["beb9cd08-b670-4372-bebb-c5ab5af8e430"]}],"id":"89c46d12-909f-4a7b-b582-777f409a4ac2","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"283242a8-1ccf-4e4a-b65c-4ffac79f766a"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Check more examples"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"76638dd5-e923-4c37-8934-99f03447a159","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#d9d9d9","blurHash":"LjK^yzv|NGt6_NWBoKxubckqIobc","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:10:23Z","src":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:rg1y72eKw6o","alt":"photography of people inside room during daytime","sizes":{"full":{"file":"media\/unsplash:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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:rg1y72eKw6o","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573164574511-73c773193279?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxMDh8fHNvZnR3YXJlJTIwZGV2ZWxvcGVyfGVufDB8fHx8MTY3MDMzNjMzMA&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=AWJwhCFcgWOB8O4wGdNrsMGyJwnTqyKLehN0FuFqNYyrxJVXxXJq6rfp7OjoSTDQSEVFYBxu3UXDi743W3AyZLSELiTtzAmW9z4CAmO7oz43orQ9AeVnbJo4y%2BuzJSaFtpX9g6vNSND\/XvDGQt35uPVoN9p0k%2Bd8vqKaRRBHy4ntdzXQuSjcaktuxqRXc2ygb3zDeJmS6JkbU9%2BzDZiKse2zeMQYh1w9B8S12rvNZM\/2hfCY11iO\/X0W4FRBkFOXiqCnBuE8"},"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,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"90701d05-70b8-48ba-9066-72199e99b3ce","id":"ca607fc3-47ce-46f2-be0f-336346011aab","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">This approach is based on two cases- &nbsp;&nbsp;<\/span>\n\n<span style=\"color: #fff\">1. Take last element &amp; calculate sum = target sum - value of last element &amp; elements remaining = size of array - 1.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":341,"height":257,"basedOn":"94bfec13-62c1-4925-8c9b-5e13821d634a","x":36,"y":165,"groupId":null,"id":"91e1f96d-98c1-4640-bbd8-2ceb2f611100","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque"},"fontSize":47,"backgroundColor":{"color":{"r":5,"g":34,"b":88}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"content":"<span style=\"font-weight: 700; color: #3372e0\">Recursive Approach<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":29,"width":410,"height":72,"marginOffset":-33.45600000000001,"basedOn":"d9f4247a-55f3-459c-ac67-260e83620ff7","groupId":null,"id":"9c230cad-a36e-4bfe-864b-cdbff9f1f09e","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"d1757342-184c-48e6-a327-1672fa4c6095","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["91e1f96d-98c1-4640-bbd8-2ceb2f611100"]},{"id":"131e3b65-acd7-4888-9d8b-d6d7b74aae20","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["76638dd5-e923-4c37-8934-99f03447a159"]},{"targets":["9c230cad-a36e-4bfe-864b-cdbff9f1f09e"],"id":"b6731b67-1af1-4485-b577-dd262b110158","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"id":"de3e1538-90d1-44c3-9dc1-e9eb15aea441","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"27f2951c-8b6e-4772-8cc9-8a5b431fd5c6"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Read more"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"27f2951c-8b6e-4772-8cc9-8a5b431fd5c6","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#f3a673","blurHash":"LjL|T1tTAvs9pytR-oRj%3WXadae","type":"image","mimeType":"image\/jpeg","creationDate":"2019-11-07T22:31:26Z","src":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","width":6016,"height":4016,"id":"media\/unsplash:eS72kLFS6s0","alt":"people sitting beside rectangular brown table with laptops","sizes":{"full":{"file":"media\/unsplash:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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:eS72kLFS6s0","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165759995-5865a394a1aa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw2M3x8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjY5OTAyNjU0&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=AWJwhCHWU%2BqKzAr8\/GMMQVqPspJuX\/C4Xn4rECmLCV93N90uMAWDH%2BKbqdnoOqXHGHKDD7ORnoiR6GvvJ7v0RNNjP3nS4zANKxaEwC4Bhg6YKPudMdd2JHUfoWW01GGoGeh7mk2drSQJAZoy2Ygz8%2BumHKJ6UoMmf18E4cxvxK0IkDv3ea6ziG0wErS304bHYKpDsaB5zdJdI1LqNlnevp1o60i00RsEq5aP\/1KdyXWyarkr95ZXY3ragEV1iFhrOJmonA%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,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"ca607fc3-47ce-46f2-be0f-336346011aab","id":"f24b57dc-e5b9-416a-be22-4a071ebd4794","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">2. Don't take last element &amp; calculate the sum = target sum &amp; elements remaining = size of array - 1.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":149,"basedOn":"91e1f96d-98c1-4640-bbd8-2ceb2f611100","x":29,"y":218,"groupId":null,"id":"9cdf83be-84a7-4e37-9e13-228230d7f1b6","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"716e5d49-d654-4dca-86d2-fcf61887a02d","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["27f2951c-8b6e-4772-8cc9-8a5b431fd5c6"]},{"id":"767e7744-400f-4a7a-b7a9-0c824b2f80b9","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["9cdf83be-84a7-4e37-9e13-228230d7f1b6"]}],"id":"9e5d6a53-c17c-415a-b590-e6df6d6fd3f4","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"0173d9f5-2320-425e-80b2-65ec1d738f9c"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"See code implementation"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":220,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"4bea2dab-2033-49a6-a9a8-b6dc345abb9c","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/jpeg","width":6016,"height":4016,"sizes":{"full":{"file":"media\/unsplash:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","mimeType":"image\/jpeg","width":6016,"height":4016},"large":{"file":"media\/unsplash:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&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:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&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:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&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:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&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:c6wbSBaYxkY","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&ixlib=rb-4.0.3&fm=jpg&w=340&h=227&fit=max","mimeType":"image\/jpeg","width":340,"height":227}},"isPlaceholder":false,"isExternal":true,"needsProxy":false,"id":"media\/unsplash:c6wbSBaYxkY","baseColor":"#262626","blurHash":"LfHBSZwatRI;~UM_t8Rj-URjM|R+","creationDate":"2019-11-07T22:31:26Z","src":"https:\/\/images.unsplash.com\/photo-1573165706511-3ffde6ef1fe3?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwxM3x8c29mdHdhcmUlMjBkZXZlbG9wZXJzfGVufDB8fHx8MTY3MjkyMDQ4OQ&ixlib=rb-4.0.3&fm=jpg&w=6016&h=4016&fit=max","alt":"three women sitting beside wooden table","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=AXhJFEdJpTQhya4OyY%2BSgPEGH7SB9a7rv6KzX%2BLUgwsFBBCS5p2fKkkeyAnOO%2BapZ7ma1hu2eyb0o9We1ppDCrG%2Be9T2DOt3L59vhxPv%2Bors17KeKHuhGecyOcuAa%2B8R9aumrDhldwtVTsPDzJh9xGbuEquFMePRQwPOekDh5783\/eLbiOEvr\/Bze8rAvuzAweCNSznvK3KroG2wvXYXWIXYCPL6lU80P9f5xcntvK06ygFxUPe1hKUrjII3VNGIjFvUPjao"}},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"f24b57dc-e5b9-416a-be22-4a071ebd4794","id":"2ad5ac42-0aab-4934-a886-dd828e311d1a","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"font-weight: 700; color: #347eff\">Time complexity of Recursive Approach&nbsp;<\/span>\n\n<span style=\"color: #fff\">The time complexity of this approach is exponential, but why? Click on the link below to find out the answer.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":257,"basedOn":"9cdf83be-84a7-4e37-9e13-228230d7f1b6","x":34,"y":164,"groupId":null,"id":"10752c12-70a7-4a16-8ef9-0e5287245dc9","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"a085bb41-cadd-41ec-8f93-9404e9f53204","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["4bea2dab-2033-49a6-a9a8-b6dc345abb9c"]},{"id":"1ed8c261-1b0e-4640-8245-82ecc9d30abe","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["10752c12-70a7-4a16-8ef9-0e5287245dc9"]}],"id":"cf434d3e-3132-4b3c-87e0-5ae80860d37a","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"07cb1230-628a-4b45-910c-b13bf7f662ea"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Explore now"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":439,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"07cb1230-628a-4b45-910c-b13bf7f662ea","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/jpeg","width":2707,"height":3608,"sizes":{"full":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=2707&h=3608&fit=max","mimeType":"image\/jpeg","width":2707,"height":3608},"large":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=2165&h=2886&fit=max","mimeType":"image\/jpeg","width":2165,"height":2886},"1624_2165":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=1624&h=2165&fit=max","mimeType":"image\/jpeg","width":1624,"height":2165},"1082_1442":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=1082&h=1442&fit=max","mimeType":"image\/jpeg","width":1082,"height":1442},"541_721":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=541&h=721&fit=max","mimeType":"image\/jpeg","width":541,"height":721},"web_stories_thumbnail":{"file":"media\/unsplash:xTHcNZAQzbM","sourceUrl":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=340&h=453&fit=max","mimeType":"image\/jpeg","width":340,"height":453}},"isPlaceholder":false,"isExternal":true,"needsProxy":false,"id":"media\/unsplash:xTHcNZAQzbM","baseColor":"#a6c0c0","blurHash":"LIHog[%~0#?c;]0LXS_2XnnK#ktR","creationDate":"2020-02-19T19:00:28Z","src":"https:\/\/images.unsplash.com\/photo-1582138825658-fb952c08b282?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw0NHx8amF2YSUyMGRldmVsb3BlcnxlbnwwfHx8fDE2NzMwMDg0NzY&ixlib=rb-4.0.3&fm=jpg&w=2707&h=3608&fit=max","alt":"man in blue hoodie looking at macbook","attribution":{"author":{"displayName":"Muha Ajjan","url":"https:\/\/unsplash.com\/@isword?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AXhJFEcEY%2BT7c0qTV1kZVyncP1bslVbnc1dE7RsCCOxz2qoRLxJrmb7JVftbWn%2BZ5HCst6ZrN5RASgilHjFmh\/NokkrOX%2BYHinbYI2pESFPJl4vVJkQCvYE3GumNPGxnxtYHDatbuYeb%2BBO5%2BEH2xylRdagcyIQbaO3bb1KYXRl%2BZNnCRR4dqB0\/TLmgERYMQaruO8DfuHJeATfU7cTkhG7UElOwWk%2Bn0goYHsDPl0zfj\/AUuzEcctZ8\/YvKdts%3D"}},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"41a8dcee-ac6c-4e09-becf-468b8665bb19","id":"ddd85b20-5151-46db-b5aa-6c37b1273284","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"color: #fff\">1. Make a 2D array of size equal to (size of array + 1) * (target sum + 1) of boolean type. &nbsp;<\/span>\n\n<span style=\"color: #fff\">2. The state dp[i][j] will be true if there is a subset of elements from A[0\u2026.i] with a sum value equal to j.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":293,"basedOn":"d2221497-d2ea-45d3-8599-eaabe9e325ef","x":39,"y":219,"groupId":null,"id":"5a80f896-83ce-48d0-b555-413c716f09c1","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"FILL","font":{"family":"Darker Grotesque"},"fontSize":47,"backgroundColor":{"color":{"r":5,"g":34,"b":88}},"lineHeight":0.9,"textAlign":"center","padding":{"locked":true,"hasHiddenPadding":true,"horizontal":8,"vertical":4},"content":"<span style=\"font-weight: 700; color: #3372e0\">Dynamic Programming Approach<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"x":0,"y":29,"width":410,"height":156,"marginOffset":-33.45600000000001,"basedOn":"9c230cad-a36e-4bfe-864b-cdbff9f1f09e","groupId":null,"id":"a727cbf9-964e-41bd-b669-dbd2d8feaaa7","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"f1474678-2664-42cc-841f-856a33508eaf","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["5a80f896-83ce-48d0-b555-413c716f09c1"]},{"id":"cbfe5f2d-e577-4a06-82ee-75b0f55761ff","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["07cb1230-628a-4b45-910c-b13bf7f662ea"]},{"targets":["a727cbf9-964e-41bd-b669-dbd2d8feaaa7"],"id":"42e2206f-c852-425e-bfef-c52423e44a72","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0}],"id":"015ce16c-01eb-4503-a5fd-c69fd2ace5d2","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"abc994fd-18e5-4821-9439-6a805f711046"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Check the algorithm"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":494,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"abc994fd-18e5-4821-9439-6a805f711046","scale":100,"focalX":50,"focalY":50,"resource":{"type":"image","mimeType":"image\/jpeg","width":4016,"height":6016,"sizes":{"full":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=4016&h=6016&fit=max","mimeType":"image\/jpeg","width":4016,"height":6016},"large":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=3212&h=4812&fit=max","mimeType":"image\/jpeg","width":3212,"height":4812},"2409_3609":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=2409&h=3609&fit=max","mimeType":"image\/jpeg","width":2409,"height":3609},"1606_2406":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=1606&h=2406&fit=max","mimeType":"image\/jpeg","width":1606,"height":2406},"803_1203":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=803&h=1203&fit=max","mimeType":"image\/jpeg","width":803,"height":1203},"web_stories_thumbnail":{"file":"media\/unsplash:7VmGD9XkYOU","sourceUrl":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=340&h=509&fit=max","mimeType":"image\/jpeg","width":340,"height":509}},"isPlaceholder":false,"isExternal":true,"needsProxy":false,"id":"media\/unsplash:7VmGD9XkYOU","baseColor":"#f3f3f3","blurHash":"LzN,[69FRjxu~qxuazoftRt7t7M{","creationDate":"2019-11-11T18:11:49Z","src":"https:\/\/images.unsplash.com\/photo-1573495627094-cbfef909a47b?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHw4MHx8c29mdHdhcmUlMjBkZXZlbG9wZXJ8ZW58MHx8fHwxNjczNDQzODM1&ixlib=rb-4.0.3&fm=jpg&w=4016&h=6016&fit=max","alt":"shallow focus photo of woman using gray laptop computer","attribution":{"author":{"displayName":"Christina @ wocintechchat.com","url":"https:\/\/unsplash.com\/fr\/@wocintechchat?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AXhJFEcL27\/qCe6Za60a\/mUu2t%2Bh9ivyL1F7btcqJDOjuR3X%2BLHAQj7EnjcR6LGjJM%2B99yMyYTURXY\/5iGRAVRVy50hpwveDKfDOT8nKPPOxwjbCOSNS1WVevKSNne1L7poD9k5vR6%2BUf3d\/nnG2wMiG8lY46GVO%2BQAgLKNl6azIvdvLXzxtqSouXN1D%2BXkK9%2BdsVD0nXZgTovk1K9IbsaASfUVXhR6EzoJX1uRBjV2kw8KIw%2Bz\/1y7Szenitaduae9nfA%3D%3D"}},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.5}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"ddd85b20-5151-46db-b5aa-6c37b1273284","id":"0a76cce9-5584-441b-bdfc-8adb40d0cc18","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":null,"vertical":null},"content":"<span style=\"font-weight: 700; color: #347eff\">Time Complexity: <\/span><span style=\"color: #fff\">O(N * sum) where N is array size.<\/span><span style=\"color: #347eff\">&nbsp;<\/span>\n\n<span style=\"font-weight: 700; color: #347eff\">Space Complexity:<\/span><span style=\"color: #347eff\"> <\/span><span style=\"color: #fff\">O(N * sum) where N is array size.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":184,"basedOn":"5a80f896-83ce-48d0-b555-413c716f09c1","x":30,"y":209,"groupId":null,"id":"68dc11dc-e204-44c0-b174-4c7e4f8d8ead","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"76997c67-7ae8-4a63-89cd-4f6d319f3149","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["68dc11dc-e204-44c0-b174-4c7e4f8d8ead"]},{"id":"5fa4a8b3-d0ad-4d6e-a0a4-c6cf80843bcc","type":"effect-background-zoom","zoomDirection":"scaleOut","duration":2000,"delay":0,"targets":["abc994fd-18e5-4821-9439-6a805f711046"]}],"id":"8df77031-9e15-4779-a2a9-fe68c9e86633","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"1a4302e2-14d2-4e1b-a167-83e3c20cc912"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"Explore now"}},{"elements":[{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":48,"y":0,"width":330,"height":219,"mask":{"type":"rectangle"},"isBackground":true,"type":"image","id":"07cb1230-628a-4b45-910c-b13bf7f662ea","scale":100,"focalX":50,"focalY":50,"resource":{"baseColor":"#0c2626","blurHash":"L33[xbocMwRkIUWAayof4ma#xvt6","type":"image","mimeType":"image\/jpeg","creationDate":"2015-12-27T03:41:04Z","src":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=4256&h=2832&fit=max","width":4256,"height":2832,"id":"media\/unsplash:Q1p7bh3SHj8","alt":"photo of outer space","sizes":{"full":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=4256&h=2832&fit=max","mimeType":"image\/jpeg","width":4256,"height":2832},"large":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=3404&h=2265&fit=max","mimeType":"image\/jpeg","width":3404,"height":2265},"2553_1699":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=2553&h=1699&fit=max","mimeType":"image\/jpeg","width":2553,"height":1699},"1702_1133":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=1702&h=1133&fit=max","mimeType":"image\/jpeg","width":1702,"height":1133},"851_566":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=851&h=566&fit=max","mimeType":"image\/jpeg","width":851,"height":566},"web_stories_thumbnail":{"file":"media\/unsplash:Q1p7bh3SHj8","sourceUrl":"https:\/\/images.unsplash.com\/photo-1451187580459-43490279c0fa?ixid=MnwxMzcxOTN8MHwxfHNlYXJjaHwzfHxiaWclMjBkYXRhfGVufDB8fHx8MTY3MjY2MDQyNA&ixlib=rb-4.0.3&fm=jpg&w=340&h=226&fit=max","mimeType":"image\/jpeg","width":340,"height":226}},"attribution":{"author":{"displayName":"NASA","url":"https:\/\/unsplash.com\/@nasa?utm_source=web_stories_wordpress&utm_medium=referral"},"registerUsageUrl":"https:\/\/media3p.googleapis.com\/v1\/media:registerUsage?token=AXhJFEcXHBQIrntAg6HooRUw5WXm7AxzRvs5HbuFuQN8QDw3Ai0kjzjMRQlR%2B1thZZL4roDPCOHwuZcp9O6zjxy9M6fH\/O2EZBkyr14DGGNtIxmkhy6AYPH8Y9vuDiwCgt8kSoj1hkEwYCWfdgp0BluVCg9E08f1HosZr1o%2Ba1LbjJXB%2Bqr\/KxEnWUM2yo06bmnbJyVBRTJLgXBxyjQ77WP3USIywZS9HBCRQihgsJKGoWP9Za4%3D"},"isPlaceholder":false,"isOptimized":false,"isMuted":false,"isExternal":true,"needsProxy":false},"overlay":{"color":{"r":0,"g":0,"b":0,"a":0.4}}},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"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},"x":0,"y":-39,"width":180,"height":60,"mask":{"type":"rectangle"},"basedOn":"2ad5ac42-0aab-4934-a886-dd828e311d1a","id":"380e77ec-becc-4e13-b03c-a3c1bed377c3","type":"image"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Anton"},"fontSize":32,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.2,"textAlign":"left","padding":{"horizontal":0,"vertical":0},"x":37,"y":242,"width":298,"height":240,"basedOn":"0da9d65f-e7a1-4e9d-bd40-318673508248","content":"<span style=\"color: #faf4ea\">Want to explore these approaches and learn how to implement them in various programming languages?<\/span>","tagName":"h2","marginOffset":-34.87060546875,"id":"3842812c-d804-48f9-b479-cbae6e5ee4fe","type":"text"},{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundTextMode":"NONE","font":{"family":"Darker Grotesque"},"fontSize":30,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"lineHeight":1.1,"textAlign":"left","padding":{"locked":true,"hasHiddenPadding":false,"horizontal":0,"vertical":0},"content":"<span style=\"font-weight: 700; color: #347eff\">Click on the link below to start your journey.<\/span>","borderRadius":{"locked":true,"topLeft":2,"topRight":2,"bottomRight":2,"bottomLeft":2},"width":352,"height":74,"basedOn":"68dc11dc-e204-44c0-b174-4c7e4f8d8ead","x":33,"y":480,"groupId":null,"id":"faf98ac9-3bde-42ce-ba57-b4ed553c9aaf","type":"text"}],"backgroundColor":{"color":{"r":255,"g":255,"b":255}},"animations":[{"id":"8c0576c4-8c49-4ed7-8b1d-7616d5423163","type":"effect-fly-in","flyInDir":"leftToRight","duration":1000,"delay":0,"targets":["3842812c-d804-48f9-b479-cbae6e5ee4fe"]},{"id":"7c42a0a9-c699-4851-b2cc-efed927d15b4","type":"effect-zoom","scaleDirection":"scaleIn","duration":2000,"delay":0,"targets":["faf98ac9-3bde-42ce-ba57-b4ed553c9aaf"]}],"id":"936b559d-4dc0-423a-9d89-b4d4ba99b081","defaultBackgroundElement":{"opacity":100,"flip":{"vertical":false,"horizontal":false},"rotationAngle":0,"lockAspectRatio":true,"backgroundColor":{"color":{"r":196,"g":196,"b":196}},"x":1,"y":1,"width":1,"height":1,"mask":{"type":"rectangle"},"isBackground":true,"isDefaultBackground":true,"type":"shape","id":"5e0b0d71-adf4-40a7-b66a-df56c38694fc"},"pageAttachment":{"url":"https:\/\/www.interviewbit.com\/blog\/subset-sum-problem\/?utm_source=Ib&utm_medium=subset-sum-problem&utm_campaign=webstories","icon":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2021\/10\/14-Subset-Sum-Problem.jpg","needsProxy":false,"ctaText":"SWIPE UP"}}],"fonts":{"Roboto":{"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}},"Darker Grotesque":{"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}},"Anton":{"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}}},"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":15677,"url":"https:\/\/www.interviewbit.com\/blog\/wp-content\/uploads\/2023\/01\/cropped-subset-sum-problem-18th.png","width":640,"height":853,"needsProxy":false},"_links":{"self":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/15675"}],"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":3,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/15675\/revisions"}],"predecessor-version":[{"id":15680,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/15675\/revisions\/15680"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/media\/15677"}],"wp:attachment":[{"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/media?parent=15675"}],"wp:term":[{"taxonomy":"web_story_category","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web_story_category?post=15675"},{"taxonomy":"web_story_tag","embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web_story_tag?post=15675"}],"wp:lock":[{"embeddable":true,"href":"https:\/\/www.interviewbit.com\/blog\/wp-json\/web-stories\/v1\/web-story\/15675\/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}]}}