A Pen by Pruthvi Raj on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sets = [ [0], #see this dummy set it is important, this is set_0 | |
| #because initially we add -arr[0] or arr[0] to 0 | |
| [10,-10], | |
| [30,-10,10,-30], | |
| [100,20,40,-40,60,-20,-80,0,-60,-100], | |
| [60,0,20,-40,-20,-60]] | |
| # my array is 1 based so ignore the zero | |
| arr = [0,10,20,40,30] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from collections import defaultdict | |
| from matplotlib import animation | |
| import matplotlib.patches as patches | |
| import math | |
| global_R = 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import heapq | |
| import math | |
| numTests = int(input())+1 | |
| def getminind(l): | |
| return heapq.nsmallest(1, ((k, i) for i, k in enumerate(l)))[0][1] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| class Vertex: | |
| def __init__(self, node): | |
| self.id = node | |
| self.adjacent = {} |
OlderNewer