[β]
β
bitchan
[?] help
π
host1.bitchan.one
π
@cqNbz~Mu
β±
5d seen
β
0
π
0
β§
1
π hide
send βΏitcoin
[!] follow
[@] review
posts 1
/ 1
[β₯] sort oldest
β±
filter [-]
languages:
on
other
/technology
What's the smart way to solve it? The logic I think is necessary is: Every alloy ID should have a list of alloy IDs that are weaker than it. For every pair of alloys N and M, where N is stronger than M, update list N to include alloy M, update any list K that includes N to also include M, update any list J that includes K to also include M, repeat as necessary. Is there a simpler way to do it?
β±
4d
β©
1
mine solution was basically: >make a dict where the key is the allow and the value is a list of alloys known to be weaker than it >make a list of all alloys >find the alloy that isn't in any other alloy's "weaker than" list >that's the strongest >now iterate through the list again, ignoring the strongest alloy, to find the other alloy not in anyone's list >that's the second strongest alloy >keep iterating til you've assigned them all probably a faster way of doing it, but it's pretty simple conceptually
β±
4d
β©