You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"allShortcutsEnabled":false,"fileTree":{"dp":{"items":[{"name":"buy_sell_stock.py","path":"dp/buy_sell_stock.py","contentType":"file"},{"name":"climbing_stairs.py","path":"dp/climbing_stairs.py","contentType":"file"},{"name":"coin_change.py","path":"dp/coin_change.py","contentType":"file"},{"name":"combination_sum.py","path":"dp/combination_sum.py","contentType":"file"},{"name":"egg_drop.py","path":"dp/egg_drop.py","contentType":"file"},{"name":"house_robber.py","path":"dp/house_robber.py","contentType":"file"},{"name":"job_scheduling.py","path":"dp/job_scheduling.py","contentType":"file"},{"name":"knapsack.py","path":"dp/knapsack.py","contentType":"file"},{"name":"longest_increasing.py","path":"dp/longest_increasing.py","contentType":"file"},{"name":"matrix_chain_order.py","path":"dp/matrix_chain_order.py","contentType":"file"},{"name":"max_product_subarray.py","path":"dp/max_product_subarray.py","contentType":"file"},{"name":"max_subarray.py","path":"dp/max_subarray.py","contentType":"file"},{"name":"min_cost_path.py","path":"dp/min_cost_path.py","contentType":"file"},{"name":"num_decodings.py","path":"dp/num_decodings.py","contentType":"file"},{"name":"regex_matching.py","path":"dp/regex_matching.py","contentType":"file"},{"name":"rod_cut.py","path":"dp/rod_cut.py","contentType":"file"},{"name":"word_break.py","path":"dp/word_break.py","contentType":"file"}],"totalCount":17},"":{"items":[{"name":"array","path":"array","contentType":"directory"},{"name":"backtrack","path":"backtrack","contentType":"directory"},{"name":"bfs","path":"bfs","contentType":"directory"},{"name":"bit","path":"bit","contentType":"directory"},{"name":"calculator","path":"calculator","contentType":"directory"},{"name":"dfs","path":"dfs","contentType":"directory"},{"name":"dp","path":"dp","contentType":"directory"},{"name":"graph","path":"graph","contentType":"directory"},{"name":"heap","path":"heap","contentType":"directory"},{"name":"linkedlist","path":"linkedlist","contentType":"directory"},{"name":"map","path":"map","contentType":"directory"},{"name":"maths","path":"maths","contentType":"directory"},{"name":"matrix","path":"matrix","contentType":"directory"},{"name":"queues","path":"queues","contentType":"directory"},{"name":"search","path":"search","contentType":"directory"},{"name":"set","path":"set","contentType":"directory"},{"name":"sort","path":"sort","contentType":"directory"},{"name":"stack","path":"stack","contentType":"directory"},{"name":"strings","path":"strings","contentType":"directory"},{"name":"tmp","path":"tmp","contentType":"directory"},{"name":"tree","path":"tree","contentType":"directory"},{"name":"union-find","path":"union-find","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"README_CN.md","path":"README_CN.md","contentType":"file"},{"name":"tree.md","path":"tree.md","contentType":"file"}],"totalCount":29}},"fileTreeProcessingTime":18.565633000000002,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":128955741,"defaultBranch":"master","name":"algorithms","ownerLogin":"BhanukaUOM","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2018-04-10T15:30:06.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/28672239?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1614241199.332684","canEdit":false,"refType":"branch","currentOid":"03387faa06adc95cb26797e6a258e41d664aa376"},"path":"dp/rod_cut.py","currentUser":null,"blob":{"rawLines":["# A Dynamic Programming solution for Rod cutting problem","INT_MIN = -32767"," ","# Returns the best obtainable price for a rod of length n and","# price[] as prices of different pieces","def cutRod(price):"," n = len(price)"," val = [0]*(n+1)"," "," # Build the table val[] in bottom up manner and return"," # the last entry from the table"," for i in range(1, n+1):"," max_val = INT_MIN"," for j in range(i):"," max_val = max(max_val, price[j] + val[i-j-1])"," val[i] = max_val"," "," return val[n]"," ","# Driver program to test above functions","arr = [1, 5, 8, 9, 10, 17, 17, 20]","print(\"Maximum Obtainable Value is \" + str(cutRod(arr)))"," ","# This code is contributed by Bhavya Jain"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/BhanukaUOM/algorithms/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"rod_cut.py","displayUrl":"https://github.com/BhanukaUOM/algorithms/blob/master/dp/rod_cut.py?raw=true","headerInfo":{"blobSize":"697 Bytes","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"0272eee","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FBhanukaUOM%2Falgorithms%2Fblob%2Fmaster%2Fdp%2Frod_cut.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"24","truncatedSloc":"19"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/BhanukaUOM/algorithms/blob/master/dp/rod_cut.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/BhanukaUOM/algorithms/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/BhanukaUOM/algorithms/raw/refs/heads/master/dp/rod_cut.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"INT_MIN","kind":"constant","ident_start":57,"ident_end":64,"extent_start":57,"extent_end":73,"fully_qualified_name":"INT_MIN","ident_utf16":{"start":{"line_number":1,"utf16_col":0},"end":{"line_number":1,"utf16_col":7}},"extent_utf16":{"start":{"line_number":1,"utf16_col":0},"end":{"line_number":1,"utf16_col":16}}},{"name":"cutRod","kind":"function","ident_start":182,"ident_end":188,"extent_start":178,"extent_end":517,"fully_qualified_name":"cutRod","ident_utf16":{"start":{"line_number":5,"utf16_col":4},"end":{"line_number":5,"utf16_col":10}},"extent_utf16":{"start":{"line_number":5,"utf16_col":0},"end":{"line_number":17,"utf16_col":17}}},{"name":"arr","kind":"constant","ident_start":561,"ident_end":564,"extent_start":561,"extent_end":595,"fully_qualified_name":"arr","ident_utf16":{"start":{"line_number":20,"utf16_col":0},"end":{"line_number":20,"utf16_col":3}},"extent_utf16":{"start":{"line_number":20,"utf16_col":0},"end":{"line_number":20,"utf16_col":34}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/BhanukaUOM/algorithms/branches":{"post":"kyCR35en-vS4GLmFWl5bjz_69S_UFStM2pkRrYilE-MTPkcY_YXSyo-6Q6dRugidISXHnhFICfbol9mqxHBynw"},"/repos/preferences":{"post":"ET3ZngAcV9FYMZmKLchLTxhWD7v7mAtKMXbhNmf3cX3KlyRD_SLIDev5J_8pVCjAH9LzAP3DnkqSTsOXQTkZ_Q"}}},"title":"algorithms/dp/rod_cut.py at master · BhanukaUOM/algorithms","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}