scph5500.bin 26-Aug-2018 20:47 512.0K
scph5501.bin 26-Aug-2018 20:47 512.0K
scph5502.bin 26-Aug-2018 20:47 512.0K
// ranker is a helper type for the rank function. | |
type ranker struct { | |
f []float64 // Data to be ranked. | |
r []int // A list of indexes into f that reflects rank order after sorting. | |
} | |
// ranker satisfies the sort.Interface without mutating the reference slice, f. | |
func (r ranker) Len() int { return len(r.f) } | |
func (r ranker) Less(i, j int) bool { return r.f[r.r[i]] < r.f[r.r[j]] } | |
func (r ranker) Swap(i, j int) { r.r[i], r.r[j] = r.r[j], r.r[i] } |
scph5500.bin 26-Aug-2018 20:47 512.0K
scph5501.bin 26-Aug-2018 20:47 512.0K
scph5502.bin 26-Aug-2018 20:47 512.0K
I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.
So below I made a list of leetcode problems that are as close to grokking problems as possible.
import Foundation | |
import HealthKit | |
struct WorkoutSplit: Hashable { | |
let label: String | |
let distance: HKQuantity | |
let duration: TimeInterval | |
} | |
extension WorkoutSplit { |
import heapq | |
from typing import List | |
def djikstra(graph_inner, starting, vertices) -> List: | |
pq = [] | |
dist = [float('inf') for i in range(vertices)] | |
dist[starting] = 0 | |
print(dist) | |
heapq.heappush(pq, [0, starting]) |
I have spent quite a bit of time figuring out automounts of NFS shares in OS X...
Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:
/etc/auto_master (see last line):
#
# Automounter master map
#
+auto_master # Use directory service
def is_safe(graph, colours, colour, current): | |
neighbours = graph[current] | |
for neighbour in neighbours: | |
if colour == colours[neighbour - 1]: | |
return False | |
return True | |
def graph_traversal(graph, colours, vertices, current): | |
if current == vertices + 1: | |
return True |
class Node: | |
def __init__(self, data: list, level, f_val): | |
self.data = data | |
self.level = level | |
self.f_val = f_val | |
def generate_children(self): | |
children = [] | |
values = [[0, 1], [1, 0], [-1, 0], [0, -1]] | |
row, col = self.find() |
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.pdb | |
*.dll.config | |
*.cache |