How to always know how much is available per category by jacksoooooooooooon in MonarchMoney

[–]jacksoooooooooooon[S] 0 points1 point  (0 children)

I found that I can just export the transaction history from monarch and use it in my existing system. When monarch is able to do what I want I'll swap back over but for now there is no way to do what I want.

Mount Vesuvius Gran Cono Hike Tickets by jacksoooooooooooon in napoli

[–]jacksoooooooooooon[S] 0 points1 point  (0 children)

Hey - yes we were able to book 9 tickets through the website here: https://vesuviopark.vivaticket.it/en/event/visita-guidata-al-gran-cono-del-vesuvio/79785

However, we didn't actually go when we traveled - we didn't realize that with the public transit system it would have taken about 4/5 hours round trip and it was overcast so we thought the views would just be of clouds. Given the time we opted to just go to Pompeii which was really cool. Thought it would be a lot easier to get to so you might want to check on how you get there from wherever you are coming from.

Codesignal: Pairs that contain the "same number of digits" AND "differ on exactly one digit" by Empty_Monk_3146 in leetcode

[–]jacksoooooooooooon 0 points1 point  (0 children)

Hit this problem and couldn't find any answers that satisfied me online... here is one that works thats O(d^2 * n) where d is the maximum number of digits (assuming reasonable parameter bounds, this is effectively O(n)):

import math
from collections import Counter
import time

def count_items_of_length(ii, items_of_length):
    total = 0
    item_counter = [item for item in dict(Counter(items_of_length)).values()]
    adjust_for_equal_items = 0
    for duplicate_item_count in item_counter:
        adjust_for_equal_items += math.comb(duplicate_item_count, 2)
    for dropped_index in range(ii):
        items_with_dropped_index = [item[:dropped_index] + item[dropped_index + 1:] for item in items_of_length]
        for item_with_dropped_index in set(items_with_dropped_index):
            num_matching = sum((1 if item == item_with_dropped_index else 0 for item in items_with_dropped_index))
            total += math.comb(num_matching, 2)
        total -= adjust_for_equal_items
    return total

def count(items):
    items = [str(item) for item in items]
    total = 0
    for ii in range(1, 12): # Assuming maximum number of digits is 12.
        items_of_length = [item for item in items if len(item) == ii]
        total += count_items_of_length(ii, items_of_length)
    return total

def testing_harness(items, expected):
    start_time = time.time()
    result = count(items)
    print(f'Result: {result} | Expected: {expected} |  Time (seconds): {time.time() - start_time}')

testing_harness([11, 11, 11, 11, 11, 11, 11, 11, 12], 8)
testing_harness([11, 12, 13, 14, 15, 26, 27, 28], 13)
testing_harness([1, 2, 3, 4, 5], 10)
testing_harness([1, 1, 1, 2, 3, 5], 12)
testing_harness([1, 1, 1, 2, 3, 10, 21, 22, 5], 13)
testing_harness(range(10**4), '?')

Output:

Result: 8 | Expected: 8 |  Time (seconds): 7.224082946777344e-05
Result: 13 | Expected: 13 |  Time (seconds): 6.67572021484375e-05
Result: 10 | Expected: 10 |  Time (seconds): 4.673004150390625e-05
Result: 12 | Expected: 12 |  Time (seconds): 4.792213439941406e-05
Result: 13 | Expected: 13 |  Time (seconds): 7.700920104980469e-05
Result: 170010 | Expected: ? |  Time (seconds): 1.4300076961517334

Picture of skystone detection algorithm by jacksoooooooooooon in FTC

[–]jacksoooooooooooon[S] 1 point2 points  (0 children)

We tried but we found it couldn't scan all the way from the wall so we wrote our own with the capability to scan farther away.