Feb. 14, 2015, 3:06 p.m. |
+1 |
Experience for voted comment bukebuer: 1 on guido: Nice use of defaultdict(set), and I like the optimization of subtracting the best trace from all_nod... |
Feb. 14, 2015, 3:06 p.m. |
+5 |
Experience for appreciated comment bukebuer: 1 on guido: Nice use of defaultdict(set), and I like the optimization of subtracting the best trace from all_nod... |
Feb. 14, 2015, 8:27 a.m. |
+1 |
Experience for voted comment bryukh: 1 on guido: Nice one! Not a word too many. Still, I couldn't help thinking of what may be an improvement: check ... |
Feb. 14, 2015, 8:27 a.m. |
+5 |
Experience for appreciated comment bryukh: 1 on guido: Nice one! Not a word too many. Still, I couldn't help thinking of what may be an improvement: check ... |
Feb. 14, 2015, 8:27 a.m. |
+1 |
Experience for voted comment bryukh: 1 on guido: Nice use of defaultdict(set), and I like the optimization of subtracting the best trace from all_nod... |
Feb. 14, 2015, 8:27 a.m. |
+5 |
Experience for appreciated comment bryukh: 1 on guido: Nice use of defaultdict(set), and I like the optimization of subtracting the best trace from all_nod... |
Sept. 8, 2014, 1:53 p.m. |
+1 |
Experience for voted comment paul_paulsen: 1 on guido: Heh. I have lots of power tools in my tool shed, but I still fix most things around the house with j... |
Sept. 5, 2014, 1:44 p.m. |
+1 |
Experience for voted comment krur: 1 on guido: All in all this code is pretty good. import math import itertools import heapq class Field(object): ... |
Aug. 4, 2014, 5:33 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: def min_diff(self, stones): What should the answer be if stones is an empty list? I think it should ... |
Aug. 4, 2014, 5:33 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: best = None If you initialize best to a large enough value you won't need to special-case "best is N... |
Aug. 4, 2014, 5:32 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: max_size = math.ceil(len(stones) / 2) Use the // operator ("floor division") to do integer division ... |
Aug. 4, 2014, 5:31 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: best = diff At this point you can actually stop if best == 0: if best == 0: return |
Aug. 4, 2014, 5:31 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: return total * len(stones) / 2 See note about constants and big Oh notation below. |
Aug. 4, 2014, 5:31 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: y_size = math.floor(total / 2) + 1 Again, I think you can use // and avoid using the math module: |
Aug. 4, 2014, 5:31 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: return x + x_size * y It's clear that you really want a two-dimensional list; then you could just wr... |
Aug. 4, 2014, 5:30 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: for x, s in enumerate(stones, 1): Your choice to start x at 1 seems odd -- in the code below, "x - 1... |
Aug. 4, 2014, 5:30 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: table[index(x, y)] = v PS. I'm not going to verify that this actually works; I'd get a headache. I t... |
Aug. 4, 2014, 5:29 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: approach = min(ALGORITHMS, key=lambda algorithm: algorithm.time(stones)) This is cute, but you don't... |
Aug. 4, 2014, 5:29 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: return approach.min_diff(stones) For extra points, you could run both solutions in parallel threads ... |
Aug. 4, 2014, 5:28 p.m. |
+1 |
Experience for voted comment MackM: 1 on guido: return 1 << (len(stones) - 1) This is probably better written as 2 ** (len(stones) - 1), so the read... |
June 29, 2014, 8:48 p.m. |
-1 |
Experience for voted comment Jiyoqisv: -1 on guido: best = None If you initialize best to a large enough value you won't need to special-case "best is N... |
May 11, 2014, 12:47 a.m. |
+2 |
Experience for voted solution korovian: 2 on Generator-guido |
March 6, 2014, 3:01 a.m. |
+5 |
Experience for appreciated comment bunnychai: 1 on guido: Well, then this is the best we can do. Fine! |
March 6, 2014, 3:01 a.m. |
+1 |
Experience for voted comment bunnychai: 1 on guido: Well, then this is the best we can do. Fine! |
March 3, 2014, 3:45 a.m. |
+5 |
Experience for appreciated comment bryukh: 1 on guido: I don't think this solution is particularly clear -- I like your projective math version better, and... |
March 3, 2014, 3:45 a.m. |
+1 |
Experience for voted comment bryukh: 1 on guido: I don't think this solution is particularly clear -- I like your projective math version better, and... |
March 3, 2014, 3:39 a.m. |
+1 |
Experience for voted comment bunnychai: 1 on guido: I love that you're defining a class here that can be reused for other similar problems. Why the rena... |
March 3, 2014, 3:39 a.m. |
+5 |
Experience for appreciated comment bunnychai: 1 on guido: I love that you're defining a class here that can be reused for other similar problems. Why the rena... |
March 3, 2014, 3:32 a.m. |
+5 |
Experience for appreciated comment bunnychai: 1 on guido: I don't think this solution is particularly clear -- I like your projective math version better, and... |
March 3, 2014, 3:32 a.m. |
+1 |
Experience for voted comment bunnychai: 1 on guido: I don't think this solution is particularly clear -- I like your projective math version better, and... |
March 2, 2014, 4:09 p.m. |
+3 |
Experience for voted solution Lijantropique: 3 on Generator-guido |
Feb. 27, 2014, 3:37 a.m. |
+1 |
Experience for voted comment lllz: 1 on guido: It's interesting that you prefer making several passes over the input string just to avoid splitting... |
Feb. 27, 2014, 3:37 a.m. |
+5 |
Experience for appreciated comment lllz: 1 on guido: It's interesting that you prefer making several passes over the input string just to avoid splitting... |
Feb. 25, 2014, 8:02 a.m. |
+3 |
Experience for voted solution dwarfjay: 3 on Generator-guido |
Feb. 22, 2014, 8:40 a.m. |
+3 |
Experience for voted solution DesmondDisturb: 2 on Generator-guido |
Feb. 21, 2014, 7:01 a.m. |
+5 |
Experience for voted solution artemrudenko: 2 on Generator-guido |
Feb. 19, 2014, 8:53 a.m. |
+5 |
Experience for appreciated comment Cjkjvfnby: 1 on guido: It's interesting that you prefer making several passes over the input string just to avoid splitting... |
Feb. 19, 2014, 8:53 a.m. |
+1 |
Experience for voted comment Cjkjvfnby: 1 on guido: It's interesting that you prefer making several passes over the input string just to avoid splitting... |
Feb. 19, 2014, 8:43 a.m. |
+4 |
Experience for voted solution Cjkjvfnby: 1 on Generator-guido |
Feb. 19, 2014, 2:54 a.m. |
+17 |
Experience for voted solution bryukh: 3 on Generator-guido |
Feb. 19, 2014, 2:49 a.m. |
+20 |
Experience for solved mission The Hidden Word |
Jan. 28, 2014, 2:16 p.m. |
+1 |
Experience for voted comment kagamimoe: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Dec. 14, 2013, 4:22 p.m. |
+1 |
Experience for voted comment Anthem: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Nov. 29, 2013, 4:32 a.m. |
+1 |
Experience for voted comment AdamHoward: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Nov. 21, 2013, 11:33 p.m. |
+5 |
Experience for solved mission Extra dashes |
Oct. 9, 2013, 7:31 p.m. |
+1 |
Experience for voted comment Viper: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Sept. 23, 2013, 8:39 p.m. |
+1 |
Experience for voted comment TheBeege: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Sept. 22, 2013, 8:28 p.m. |
+1 |
Experience for voted comment MasterSouffle: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Aug. 30, 2013, 5:51 a.m. |
+1 |
Experience for voted comment Wayne: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
Aug. 3, 2013, 7:23 p.m. |
+1 |
Experience for voted comment diptiranjan: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
July 21, 2013, 7:07 a.m. |
+1 |
Experience for voted comment victorq10: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
July 13, 2013, 7:32 a.m. |
+1 |
Experience for voted comment Reloader: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
July 9, 2013, 11:26 a.m. |
+1 |
Experience for voted comment stb2: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
May 17, 2013, 7:28 p.m. |
+1 |
Experience for voted comment Tiktin: 1 on guido: in decrypt(data, cipher) What made you break the long line this way? It would look much better like ... |
April 27, 2013, 11:49 p.m. |
+1 |
Experience for voted comment bryukh: 1 on guido: best = diff At this point you can actually stop if best == 0: if best == 0: return |
April 27, 2013, 11:49 p.m. |
+1 |
Experience for voted comment fossilet: 1 on guido: diff = abs(2 * part - total) Style nit: Contrary to what many people seem to believe PEP 8 specifies... |
April 27, 2013, 11:47 p.m. |
+1 |
Experience for voted comment bryukh: 1 on guido: def min_diff(self, stones): What should the answer be if stones is an empty list? I think it should ... |
April 27, 2013, 11:47 p.m. |
+1 |
Experience for voted comment Tiktin: 1 on guido: return 1 << (len(stones) - 1) This is probably better written as 2 ** (len(stones) - 1), so the read... |
April 16, 2013, 12:45 a.m. |
+1 |
Experience for voted comment fossilet: 1 on guido: if __name__ == '__main__': It's hardly necessary to add the 'First' or 'Second' messages to the asse... |
April 16, 2013, 12:44 a.m. |
+1 |
Experience for voted comment Ganet: 1 on guido: This is a perfectly acceptable solution for passwords, which are typically not very long. I am going... |
April 16, 2013, 12:43 a.m. |
+1 |
Experience for voted comment fossilet: 1 on guido: 'Return True if password strong and False if not' Most programming style guides use "triple double" ... |